There is no support for this in C #, but maybe you can get around this and do something “next to” the listing using tuples or anonymous types if you only need to switch some state and you don't need to do any or special operations with it.
For example, using tuples, you can do this:
var someFakeEnum = Tuple.Create(0, 1);
UPDATE :
C # 7 introduced syntax tuples:
var someFakeEnum = (State1: 0, State2: 1);
Or with anonymous types:
var someFakeEnum = new { State1 = 0, State2 = 1 };
And after that you can do something like:
int state = 0; // If you're using tuples... if(some condition) { state = someFakeEnum.Item2; } // ...or if you're using anonymous types or C
Obviously, this is not an actual enumeration, and you don’t have the sugar that the Enum type provides you, but you can still use binary operators such as OR, AND or legend, like any other actual enumeration.
source share