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()
        {

                
                
                bool  defined  =  Enum.IsDefined(typeof(Color),  5);
                Console.WriteLine("5  is  a  defined  value  for  Color:  {0}",  defined);        
                
        }
}
    
   
  
   



Output

5 is a defined value for Color: False


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» System.Enum