Output enum values : enum format « Data Type « C# / CSharp Tutorial






using System;

enum Color
{
   Green,
   Yellow,
   Red
}

class MainClass
{
   static void Main()
   {
      Console.WriteLine("{0}", Color.Green);
      Console.WriteLine("{0}", Color.Yellow);
      Console.WriteLine("{0}", Color.Red);
   }
}
Green
Yellow
Red








2.38.enum format
2.38.1.Output enum values
2.38.2.Format an enumeration.
2.38.3.Converting an enumerated value to a string.