I have an enum
private enum EventColors
{
Aquamarine,
Azure,
BurlyWood,
CadetBlue,
Gainsboro,
Gold,
Gray,
Khaki,
LawnGreen,
LightGreen,
LightSkyBlue,
Linen,
MediumOrchid,
MediumPurple,
MistyRose,
Olive,
OliveDrab,
Orange,
OrangeRed,
Orchid,
PaleTurquoise,
Peru,
Pink,
Plum,
RoyalBlue,
SandyBrown,
SeaGreen,
SteelBlue,
};
I chose the best from System.Drawing.Color and I would like to randomly choose one:
Array values = Enum.GetValues(typeof(EventColors));
Random rnd = new Random();
EventColors randomBar = (EventColors)values.GetValue(rnd.Next(values.Length));
How can I convert random chosen color from my enum to System.Drawing.Color. ? Is this possible without using switch?