0

What is exactly fallthrough behaviour in c#???

17th May 2018, 5:07 AM
Vedantee Pathak
Vedantee Pathak - avatar
2 Antworten
+ 5
Switch statement. Switch fallthrough is historically one of the major source of bugs in modern softwares. The language designer decided to make it mandatory to jump at the end of the case, unless you are defaulting to the next case directly without processing. switch(value) { case 1:// this is still legal case 2: }
17th May 2018, 5:21 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 3
Falling through switch-cases can be achieved by having no code in a case, or using the special goto case or goto default forms: switch(num) { case 1: case 2: //do something goto case 3; case 3: //do something goto default; default: break; }
17th May 2018, 5:37 AM
Rusty.Metal