public enum sEnum
{
zero = 0, one = 1
}
public int x;
public static void a(sEnum s)
{
x = 3;
if (s == sEnum.one) ...
}
Why can values of the enum be checked here, as the static keyword isn’t used? Where is this documented in the language specification?
Enums are just named values so you can use them in a static context just like any other constant.
Section 3.4.3 of the language specification states: