When you define an enum, the individual values can be implicitly defined (one greater than the previous value), assigned to a constant, or assigned to any constant expression.
In the definition of the Moods enumerated type below, constant expressions are used for some of the values.
1
2
3
4
5
6
7
8
9
10
11
| public const int HappyFactor = 42;public enum Moods{ NOMOOD = 0, Ambivalent = 1, Crabby = 10, Grouchy = Crabby - 1, Happy = HappyFactor, SuperHappy = 2 * Happy} |

