Assign enum value from a member and variable : Enum : Data Type C# Examples


C# Examples » Data Type » Enum »

 

Assign enum value from a member and variable









    
using  System;

enum  Color
{
      Green,
      Yellow,
      Red
}

class  MainClass
{
      static  void  Main()
      {
            Color  t1  =  Color.Red;          
            Color  t2  =  Color.Green;      
            Color  t3  =  t2;                                      

            Console.WriteLine(t1);
            Console.WriteLine(t2);
            Console.WriteLine(t3);
      }
}
    
   
  
   



Output

Red
Green
Green


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Enum