C# switch
I've been so busy this past week that I've neglected to follow up on my problems with the C# switch statement.
Maybe this entry I found on the MSDN website will be useful:
"Unlike the C++ switch statement, C# does not support an explicit fall through from one case label to another. If you want, you can use goto a switch-case, or goto default."
So I suppose that would go a little something like this:
switch(ch) {
case 'a':
x *= 1024;
goto case 'b';
case 'b':
x *= 1024;
goto case 'c';
case 'c':
x *= 1024;
break;
default:
throw new Exception("unhandled case in switch statement");
}
No comments:
Post a Comment