Enum.IsDefined : Enum « System « C# / C Sharp by API






Enum.IsDefined

 

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);    
        
    }
}

        

   
  








Related examples in the same category

1.Enum.Format()
2.Enum.GetNames
3.Enum.GetUnderlyingType()
4.Enum.Parse