Mono Class Library: System NamespaceSystem.Enum Class |
See Also: Enum Members
|
A Enum is a distinct type with named constant members. Each enumeration type has a corresponding integral type called the underlying type of the enumeration type. This underlying type is required to be a system-supplied integer type that is large enough to represent all values defined in the enumeration; the field that holds the underlying type must be called value__. A Enum declaration is allowed to explicitly declare any integral type other than char as an underlying type. This includes byte, sbyte, short, int, long, ushort, uint, and ulong. A Enum declaration that does not explicitly declare an underlying type has an underlying type of int .
Enum derives from ValueType but is not a value type. Programming languages typically provide syntax to declare sets of a specified enumeration type consisting of named constants and their values.
It is possible to treat instances of a Enum as bit fields containing multiple values. For more information, see FlagsAttribute .
Note: Enum provides methods to compare instances of enumeration types, convert the value of an instance to its string representation, convert the string representation of a number to an instance of the enumeration type, and create an instance of a specified enumeration and value.[Edit]
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0