List all the Enumeration Values

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

enum Colors
{
Red, Blue, Green, Purple
}

Result:

Red
Blue
Green
Purple

Comments or Responses

Posted by: T.saravanan on: 3/31/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi,

Kindly post your code inside the code tag.
Posted by: Madhu.b.rokkam on: 3/31/2011 Level:Bronze | Status: [Member] [MVP] | Points: 10
Opps Missed this time.. Will do that.. Thanks for your comments

Login to post response