Enums
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);
Each enum member has an underlying integral value. By default:
• Underlying values are of type int.
• The constants 0, 1,
2... are automatically assigned, in the declaration
order of
the enum members.
You may specify an alternative integral type, as follows:
public enum BorderSide : byte { Left, Right, Top, Bottom }
You may also
specify an explicit underlying value for each enum member:
public enum BorderSide : byte { Left = 1, Right = 2, Top = 10, Bottom = 11 }
Thanks…
Ref C# nutshell and Google
No comments:
Post a Comment