I have the following code:
public int Method(MyEnum myEnum)
{
switch (myEnum)
{
case MyEnum.Value1: return 1;
case MyEnum.Value2: return 2;
case MyEnum.Value3: return 3;
}
}
public enum MyEnum
{
Value1,
Value2,
Value3
}
And I get the error: "Not all code paths return a value"
. I do not understand how that switch
statement could ever not jump to one of the specified cases.
Can an enum
somehow be null
?