More peculiarites of enum

The well known (or moderately known fact): C# enums can contain any value supported by its base type and not just the ones specified in the enum. Lets consider the following enum.

 enum WeekDay
{
    Monday = 1,
    Tuesday = 2,
    Wednesday = 3,
    Thursday = 4,
    Friday = 5,
    Saturday = 6,
    Sunday = 7
}

Even though the enum supports values from 1 to 7 you can do the following.

 WeekDay day = (WeekDay)40;
Console.WriteLine(day);

This prints out 40 without any error.

Now comes the lesser known fact: C# 1.2 spec sez "An Implicit enumeration conversion permits the decimal-integer-literal 0 to be converted to enum-type" . This means the following is valid code

 WeekDay day = 0;
Console.WriteLine(day);

Note that even though 0 is not supported it is implicitely casted to the enum!!! No idea why this is supported.