enum color : int { red = -3, green, blue } Console.Write( (int) color.red + ", "); Console.Write( (int) color.green + ", "); Console.Write( (int) color.blue );
enum color: int { red, green, blue = 5, cyan, magenta = 10, yellow } Console.Write( (int) color.green + ", " ); Console.Write( (int) color.yellow );
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 { red, green, blue } color c; c = color.red; Console.WriteLine(c);
enum per { married, unmarried, divorced, spinster } per.married = 10; Console.WriteLine(per.unmarried);
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.