Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error CS0163
Collapse the table of content
Expand the table of content

Compiler Error CS0163

Control cannot fall through from one case label ('label') to another

When a switch statement contains more than one switch section, you must explicitly terminate each section, including the last one, by using one of the following keywords:

If you want to implement "fall through" behavior from one section to the next, use goto case #. For more information and examples, see switch (C# Reference).

The following sample generates CS0163.

// CS0163.cs
public class MyClass
{
    public static void Main()
    {
        int i = 0;

        switch (i)   // CS0163
        {
            // Compiler error CS0163 is reported on the following line.
            case 1:
                i++;
            // To resolve the error, uncomment one of the following example statements.
            // return;
            // break;
            // goto case 3;

            case 2:
                i++;
                return;

            case 3:
                i = 0;
                return;

            // Compiler error CS0163 is reported on the following line.
            default:
                Console.WriteLine("Default");
                // To resolve the error, uncomment the following line:
            //break;
        }
    }
Show:
© 2015 Microsoft