1

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:

enter image description here

aaron
  • 39,695
  • 6
  • 46
  • 102
Ruskin
  • 1,504
  • 13
  • 25

0 Answers0