-
Notifications
You must be signed in to change notification settings - Fork 1
Enums
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
- Abstract Classes
- Access Modifiers
- Anonymous Methods
- Anonymous Types
- Arrays
- Attributes
- Console I/O
- Constructors
- Const Fields
- Delegates
- Enums
- Exceptions
- Extension Methods
- File IO
- Generics
- Interfaces
- Iterators
- LINQ
- Main
- Null Operators
- Parameters
- Polymorphism
- Virtual Functions
- Reflection
- Serialization
- Strings
- Value Types
- "Base" Keyword
- "Is" and "As"
- "Sealed" Keyword
- nameof expression