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++.

15th May 2016, 7:07 PM
dustin
2 Réponses
+ 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
20th May 2016, 10:02 AM
James Flanders
0
Because it helps you too right the code
16th Jun 2016, 3:36 AM
patty kitchens
patty kitchens - avatar