Assign Enumeration values to an Array

Madhu.b.rokkam
Posted by Madhu.b.rokkam under C# category on | Points: 40 | Views : 1521
class Program3
{
static void Main(string[] args)
{
string[] clrs = Enum.GetNames(typeof(Colors));
foreach (var color in clrs)
{
Console.WriteLine(color);
}
Console.Read();
}
}

enum Colors
{
Red, Blue, Green, Purple
}


Result

Red
Blue
Green
Purple

Comments or Responses

Login to post response