enum color : byte { red = 500, green = 1000, blue = 1500 }
enum per { married, unmarried, divorced, spinster } per.married = 10; Console.WriteLine(per.unmarried);
enum color { red, green, blue } color c; c = color.red; Console.WriteLine(c);
enum color { red, green, blue } color c = color.red; Type t; t = c.GetType(); string[ ]str; str = Enum.GetNames(t); Console.WriteLine(str[ 0 ]);
enum color: int { red, green, blue = 5, cyan, magenta = 10, yellow } Console.Write( (int) color.green + ", " ); Console.Write( (int) color.yellow );
enum color : int { red = -3, green, blue } Console.Write( (int) color.red + ", "); Console.Write( (int) color.green + ", "); Console.Write( (int) color.blue );
Copyright ©CuriousTab. All rights reserved.