disable broken tests on net_4_0
[mcs.git] / docs / ecma334 / 21.1.xml
blobd244038c0b1327957d185c51b1b8c15ea7d1f988
1 <?xml version="1.0"?>
2 <clause number="21.1" title="Enum declarations">
3   <paragraph>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. <grammar_production><name><non_terminal where="21.1">enum-declaration</non_terminal></name> : <rhs><non_terminal where="24.2">attributes</non_terminal><opt/><non_terminal where="21.2">enum-modifiers</non_terminal><opt/><keyword>enum</keyword><non_terminal where="9.4.2">identifier</non_terminal><non_terminal where="21.1">enum-base</non_terminal><opt/><non_terminal where="21.1">enum-body</non_terminal><terminal>;</terminal><opt/></rhs></grammar_production><grammar_production><name><non_terminal where="21.1">enum-base</non_terminal></name> : <rhs><terminal>:</terminal><non_terminal where="11.1">integral-type</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="21.1">enum-body</non_terminal></name> : <rhs><terminal>{</terminal><non_terminal where="21.3">enum-member-declarations</non_terminal><opt/><terminal>}</terminal></rhs><rhs><terminal>{</terminal><non_terminal where="21.3">enum-member-declarations</non_terminal><terminal>,</terminal><terminal>}</terminal></rhs></grammar_production></paragraph>
4   <paragraph>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 <keyword>byte</keyword>, <keyword>sbyte</keyword>, <keyword>short</keyword>, <keyword>ushort</keyword>, <keyword>int</keyword>, <keyword>uint</keyword>, <keyword>long</keyword> or <keyword>ulong</keyword>. <note>[Note: <keyword>char</keyword> cannot be used as an underlying type. end note]</note> An enum declaration that does not explicitly declare an underlying type has an underlying type of <keyword>int</keyword>. </paragraph>
5   <paragraph>
6     <example>[Example: The example <code_example><![CDATA[
7 enum Color: long  
8 {  
9    Red,  
10    Green,  
11    Blue  
12 }  
13 ]]></code_example>declares an enum with an underlying type of <keyword>long</keyword>. end example]</example>
14     <note>[Note: A developer might choose to use an underlying type of <keyword>long</keyword>, as in the example, to enable the use of values that are in the range of <keyword>long</keyword> but not in the range of <keyword>int</keyword>, or to preserve this option for the future. end note]</note>
15   </paragraph>
16 </clause>