Skip to content
Mario Gutierrez edited this page Jan 7, 2017 · 1 revision
enum MyEnum { Yo }
enum MyEnum
{
  Three = 3, // Will start with value 3.
  Four,
  Five
}

By default, enums use the System.Int32 (C# int) type. You can change this as follows.

enum MyEnum : byte
{
  MyByte
}

You can get the name as a string or raw value like this.

MyEnum.Three.ToString(); // "Three"
(int)MyEnum.Three; // 3
Clone this wiki locally