using System; enum Color { red, green, yellow } public class MainClass { public static void Main() { Color c = Color.red; foreach (string s in Enum.GetNames(c.GetType())) { Console.WriteLine("Name: {0}", s); } } }
Name: red Name: green Name: yellow