Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
An enum is a special value type that lets you specify a group of named numeric constants. For example:
public enum BorderSide { Left, Right, Top, Bottom }
We can use this enum type as follows:
BorderSide topSide = BorderSide.Top; bool isTop = (topSide == BorderSide.Top); // true
Each enum member has an underlying integral value. By default, the
underlying values are of type int, and
the enum members are assigned the constants 0, 1,
2... (in their declaration order). You
may specify an alternative integral type, as follows:
public enum BorderSide : byte { Left,Right,Top,Bottom }
You may also specify an explicit integral value for each member:
public enum BorderSide : byte
{ Left=1, Right=2, Top=10, Bottom=11 }