Jon Jagger
jon@jaggersoft.com
Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specificationpreviousnextprevious at this levelnext at this level 21 Enumsprevious at this levelnext at this level 21.1 Enum declarations Paragraph 11 An enum declaration declares a new enum type. 2 An enum declaration begins with the keyword enum, and defines the name, accessibility, underlying type, and members of the enum. enum-declaration : attributesopt enum-modifiersopt enum identifier enum-baseopt enum-body ;opt enum-base : : integral-type enum-body : { enum-member-declarationsopt } { enum-member-declarations , } Paragraph 21 Each enum type has a corresponding integral type called the underlying type of the enum type. 2 This underlying type must be able to represent all the enumerator values defined in the enumeration. 3 An enum declaration may explicitly declare an underlying type of byte, sbyte, short, ushort, int, uint, long or ulong. [Note: char cannot be used as an underlying type. end note] 4 An enum declaration that does not explicitly declare an underlying type has an underlying type of int. [Example: The example
enum Color: long  
{  
   Red,  
   Green,  
   Blue  
}  
declares an enum with an underlying type of long. end example]
[Note: A developer might choose to use an underlying type of long, as in the example, to enable the use of values that are in the range of long but not in the range of int, or to preserve this option for the future. end note]
{ JSL }
Jagger Software Ltd
Company # 4070126
VAT # 762 5213 42
Valid HTML 4.01Valid CSS