The C# Programming Language, Third Edition
by Anders Hejlsberg, Mads Torgersen, Scott Wiltamuth, Peter Golde
14. Enums
An enum type is a distinct value type (§4.1) that declares a set of named constants.
The example
enum Color { Red, Green, Blue }
declares an enum type named Color with members Red, Green, and Blue.
14.1 Enum Declarations
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.
enum-declaration: attributesopt enum-modifiersopt enum identifier enum-baseopt enum-body ;opt
enum-base: : integral-type
enum-body: { enum-member-declarationsopt } { enum-member-declarations , }
Each enum type has a corresponding ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access