Enumeration Elements Don’t Need to Be Sequential

Enumeration elements are implicitly set to consecutive integers, starting at 0, as indicated in the comments below.
1
2
3
4
5
6
7
8
// Default type is int
public enum Mood
{
    Crabby,      // 0
    Happy,       // 1
    Petulant,    // 2
    Elated       // 3
};
You can also assign any values you like to the constants.
1
2
3
4
5
6
7
public enum Mood
{
    Crabby = -50,
    Happy = 80,
    Petulant = -20,
    Elated = 99
};
You can define these constants in any order. They don’t have to be sequential.


1
2
3
4
5
6
7
8
9
10
public enum Days
{
    Friday = 5,
    Monday = 1,
    Saturday = 6,
    Sunday = 0,
    Thursday = 4,
    Tuesday = 2,
    Wednesday = 3
};