The System.Enum Type : System.Enum : Data Type C# Examples


C# Examples » Data Type » System.Enum »

 

The System.Enum Type









    
using  System;

enum  Color
{
        red,
        green,
        yellow
}

public  class  MainClass
{
        public  static  void  Main()
        {
                Color  c  =  Color.red;
                
                foreach  (string  s  in  Enum.GetNames(c.GetType()))
                {
                        Console.WriteLine("Name:  {0}",  s);
                }
                
        }
}
    
   
  
   



Output

Name: red
Name: green
Name: yellow


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» System.Enum