Unlike Java, you have to explicitly specify fall-through if you have any logic in your statement.
Sample Java:
switch(myInt)
{
case 1:
callSomething();
case 2:
//this will still be executed for case one
callSomethingElse();
}
Equivalent C# Code:
switch(myInt)
{
case 1:
callSomething();
goto case 2;
case 2:
callSomethingElse();
}
No comments:
Post a Comment