I have the following listing
public enum TESTENUM
{
Value1 = 1,
Value2 = 2
}
Then I want to use this to compare with the integer variable that I have:
if ( myValue == TESTENUM.Value1 )
{
}
But for this test, I have to do the enumeration as follows (or presumably declare an integer as an enumeration of type):
if ( myValue == (int) TESTENUM.Value1 )
{
}
Is there a way I can tell the compiler that an enumeration is a series of integers, so I don't need to do this casting or overriding a variable?
source
share