I am using a goto
inside of a switch statement to emulate fall through behavior.
My switch statement is using an enum
to determine which case to use.
When the case that contains the goto
is executed, the execution hangs at that point and the hosting process starts to use a lot more cpu.
My code looks something like the following:
switch (myEnum)
{
case HostClass.EnumType.var1: goto case HostClass.EnumType.var2;
case HostClass.EnumType.var2: myint = 3; break;
default: break;
}
Why does my switch statement hang on a goto? Reading online, this seems to be a common pattern.
Removing the goto fixes it, but I dont understand why.