using System; public enum Color { Red, Green, Blue } public class Example { public static void Main() { Color c = (Color) (new Random()).Next(0, 3); if (c == Color.Red) Console.WriteLine("The color is red"); else if (c == Color.Green) Console.WriteLine("The color is green"); else if (c == Color.Blue) Console.WriteLine("The color is blue"); else Console.WriteLine("The color is unknown."); } } // The example displays the following output: // The color is red