C # does not support an explicit fall through for case blocks (unless the block is empty)
For an explanation of why, see why is the C # Switch statement designed to not allow fall through, but still require a break? On msdn
The following code is not legal and will not compile in C #:
Switch (X){
Case 0:
Console
. Writeline (X)// Do somethingCase 1:
Console
. Writeline (X)// Do something in common with 0Default:
Console
. Writeline (X)// Do something in common with 0, 1 and everything elseBreak;}
In order to achieve the same effect in C # The code must be modified as shown below (Notice how the control flows are very explicit ):
Class
Test{
Static void main (){
Int x = 3;
Switch (X)
{
Case 0:
// Do something
Goto case 1;
Case 1:
// Do something in common with 0
Goto default;
Default:
// Do something in common with 0, 1, and anything else
Break;
}
}
}
Source: http://blogs.msdn.com/csharpfaq/archive/2004/07/22/191787.aspx