Example
Introduced
An enumeration is a specified constant whose underlying type can be any integral type other than Char.
If the underlying type is not explicitly declared, the Int32 is used.
Programming languages often provide syntax to declare enumerations consisting of a set of named constants and their values.
Defined
The default cardinality starts with O, and you can specify a numeric value.
Enum days {saturday=1, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday};
Enum Colors {Red = 1, Green = 2, Blue = 4, yellow = 8};
Use
Colors mycolors = colors.red;
String strcolor=mycolors.tostring ();
int intcolor= (int) mycolors;
Bit or
Colors mycolors = colors.red | Colors.blue | Colors.yellow;
Bit and
Colors mycolors = colors.red & Colors.blue & Colors.yellow;
Traverse
foreach (String s in Enum.getnames (typeof))
Response.Write (S + "--" + Enum.parse) (typeof (days), s). ToString ());
Transformation
Colors mc=colors Enum.parse (typeof (Colors), "Red");
if (System.Enum.IsDefined (typeof (Days), "Monday"))
Days of ds= (days) Enum.parse (typeof (Days), "Monday");