Do you know that? 62.9% freelancers are male, 37.1% - female next

Switch statement works differently than in C++, why?

C# does not support an explicit fall through for case blocks.

The following code is not legal and will not compile in C# :

switch(a)
{
case 0: // some code here
case 1: // some code here
default: // some code here
break;
}

To run above code in C#, the code must be modified as shown below

class Demo
{
public static void Main() 
{
int a = 3;
switch(a)
{
case 0: // do some code here
goto case 1;
case 1: // do some code here
goto default;
default: // do some code here
break;
}
}
}