-5

Lets say I have an enum like this...

internal enum SomeType
{
    Type1 = 0, 
    Type2 = 1, 
    Type3 = 2
}

and I had an int like this...

int i = 1; // would return Type2...

How do I convert that int to the enum value?

fexum
  • 1

1 Answers1

-1

You can cast it directly

SomeType someType = (SomeType)i;
Praveen Paulose
  • 5,741
  • 1
  • 15
  • 19