O'Reilly logo

Special Edition Using C# by NIIT

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Enumerations

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

Caution

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required