An enumeration type can be described as a type that consists of named constants. Enumeration types always have an underlying type. The integral type that corresponds to an enum type is the underlying type of the enum. The enumeration type is generally used in situations where a wide but fixed variety of choices need to be presented to the user who will make the decision at runtime.

enum is an enumeration type supported by C#. It is declared by using the enum keyword. It is a value type that has an underlying type. The underlying type can be any of the following:

  • int

  • uint

  • short

  • ushort

  • long

  • ulong

  • byte

  • sbyte


char cannot be used as an underlying type.

The elements of any of the types that constitute an enum are the members of the enumeration. ...

Get Special Edition Using C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.