ECMA-334 C# Language Specification21.1: Enum declarations |
An enum declaration declares a new enum type. An enum declaration begins with the keyword enum, and defines the name, accessibility, underlying type, and members of the enum.
attributes
opt enum-modifiers
optenum identifier
enum-base
opt enum-body
;
opt :
integral-type
{
enum-member-declarations
opt }
{
enum-member-declarations
,
}
Each enum type has a corresponding integral type called the underlying type of the enum type. This underlying type must be able to represent all the enumerator values defined in the enumeration. An enum declaration may explicitly declare an underlying type of byte , sbyte , short , ushort , int , uint , long or ulong .
declares an enum with an underlying type of long . end example]
enum Color: long
{
Red,
Green,
Blue
}