This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Enumerations
- An enumeration (enum) is a special form of value type, which inherits from System.Enum and supplies an alternate name for an underlying primitive type. An enum type has a name, an underlying type, and a set of fields. The underlying type must be one of the built-in signed or unsigned integer types (such as Int16, Int32, or Int64). The fields are static literal fields, each of which represents a constant. Each field is assigned a specific value of the underlying type by the language compiler. Multiple fields can be assigned the same value. When this occurs, the compiler marks exactly one of the enum values as a “primary” enum value for the value, for the purposes of reflection and string conversion.
You can assign a value of the underlying type to an enum and vice versa (no cast is requiredby the runtime). You can create an instance of an enum, and you can call the methods of System.Enum as well as any methods defined on the enum's underlying type. However, some language compilers might not allow you to pass an enum as a parameter when an instance of the underlying type is required (or vice versa).
The following additional restrictions apply to enumerations:
- They cannot define their own methods.
- They cannot implement interfaces.
- They cannot define properties or events.