Enumeration Types

An enumeration type is a distinct value type that declares a set of named constants.

Enumeration Type Declaration

An enumeration type declaration describes a new enumeration type.

enum-declaration:

attributesopt   enum-modifiersopt   Enum   enum-name   enum-baseopt   enum-body   End Enum enum-nameopt   ;

enum-name:

identifier

enum-base:

:   integral-type

enum-body:

enum-member-declarationsopt

Each enumeration type has a corresponding integral type named the underlying type of the enumeration type. This integer type must enable representation of all constants determined in the enumeration. An enumeration type declaration may explicitly declare an underlying type: Byte, SByte, Short, UShort, Integer, UInteger, Long, ULong. The Char type cannot be used as an underlying type. An enumeration type declaration that does not explicitly declare an underlying type has an underlying type of Integer.

Additional information is contained in the following subsections:

See also:

Description and Syntax Rules