Compiler Error CS0163
Control cannot fall through from one case label ('label') to another
When a case statement contains one or more statements and is followed by another case statement, you must explicitly terminate the case by using one of the following keywords:
return
goto
break
throw
continue
If you want to implement "fall through" behavior, use goto case #. For more information, see switch (C# Reference)
The following sample generates CS0163:
// CS0163.cs
public class MyClass
{
public static void Main()
{
int i = 0;
switch (i) // CS0163
{
case 1:
i++;
// uncomment one of the following lines to resolve
// return;
// break;
// goto case 3;
case 2:
i++;
return;
case 3:
i = 0;
return;
}
}
}