Let's say I have the enum
public enum Test : int
{
TestValue1 = 0,
TestValue2,
TestValue3
}
Why can't I use statements like Int32 IntTest = Test.TestValue1 without a cast to mean IntTest = 0? It would be useful if I decided later to add more items to the enumeration? I think I am forced to use Int32 IntTest = (Int32) Test.TestValue1, which I think should be redundant... Also, why can't I make something like
switch (IntTest)
{
case (Test.TestValue1) : DoSomething();
break;
case (Test.TestValue2) : DoSomethingElse();
break;
default : Do Nothing();
}
The compiler says it expects a constant value in the place of TestValue1... Isn't that value aready constant?