I have an enum:
public enum Blah
{
Value = 0,
Value2 = 1
}
And the following code:
void Main()
{
Blah? a = Blah.Value;
bool val = (a == (int) Blah.Value); // compiles
val = (a == (int) Blah.Value2); // doesn't compile
}
As you can see from the comments above, the first line compiles but the second doesn't.
Can anyone explain it? I checked the IL Interpreter and can't really see why: