Mike Read

Mike Read

  • NA
  • 2
  • 5.8k

how do I create a struct similar to system.drawing.color

Jul 23 2010 5:42 PM
I want a struct in my code that is similar in functionality to System.Drawing.Color.

basically, I want a "user friendly" way to access properties (or really for someone to understand my code)

instead of :
something = 0;
switch (something) {
case 0: ....
case 1: ....
}

I want:
something = something.FriendlyValueName;
switch (something) {
case something.FriendlyValueName: ...
case something.DifferentFriendlyValueName: ...
}

for example, with Color...

System.Drawing.Color ABC = new System.Drawing.Color.White;
switch (ABC) {
case System.Drawing.Color.Black: ...
case System.Drawing.Color.White: ...
}

does that make any sense?

Answers (1)