This documentation is archived and is not being maintained.

14.5 Enum values and operations

Visual Studio .NET 2003

Each enum type defines a distinct type; an explicit enumeration conversion (Section 6.2.2) is required to convert between an enum type and an integral type, or between two enum types. The set of values that an enum type can take on is not limited by its enum members. In particular, any value of the underlying type of an enum can be cast to the enum type, and is a distinct valid value of that enum type.

Enum members have the type of their containing enum type (except within other enum member initializers: see Section 14.3). The value of an enum member declared in enum type E with associated value v is (E)v.

The following operators can be used on values of enum types: ==, !=, <, >, <=, >= (Section 7.9.5), + (Section 7.7.4), - (Section 7.7.5), ^, &, | (Section 7.10.2), ~ (Section 7.6.4), ++, -- (Section 7.5.9 and Section 7.6.5), sizeof (Section A.5.4).

Show: