I have the following enum
public enum TESTENUM
{
Value1 = 1,
Value2 = 2
}
I then want to use this to compare to an integer variable that I have, like this:
if ( myValue == TESTENUM.Value1 )
{
}
But in order to do this test I have to cast the enum as follows (or presumably declare the integer as type enum):
if ( myValue == (int) TESTENUM.Value1 )
{
}
Is there a way that I can tell the compiler that the enum is a series of integers, so that I don’t have to do this cast or redefine the variable?