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); } }
5 is a defined value for Color: False