0
Why is fallthrough disabled in c#?
This is one of the few changes I've ever noticed that actually forces my code to be less readable (to me) from C/C++.
2 odpowiedzi
+ 5
Switch fallthrough is historically one of the major source of bugs in modern softwares.
However, falling through switch-cases can be achieved by having no code in a case (see case 0), or using the special goto case (see case 1) or goto default (see case 2) forms:
switch (/*...*/) {
case 0: // shares the exact same code as case 1
case 1:
// do something
goto case 2;
case 2:
// do something else
goto default;
default:
// do something entirely different
break;
}
Source: http://stackoverflow.com/questions/174155/switch-statement-fallthrough-in-c
0
Because it helps you too right the code