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);
enum color : byte { red = 500, green = 1000, blue = 1500 }
String s1="Kicit"; Console.Write(s1.IndexOf('c') + " "); Console.Write(s1.Length);
String s1 = "ALL MEN ARE CREATED EQUAL"; String s2; s2 = s1.Substring(12, 3); Console.WriteLine(s2);
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 );
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.