Share via


Compiler Error CS0152

The label 'label' already occurs in this switch statement

A label was repeated in a switch statement. For more information, see switch (C# Reference).

The following sample generates CS0152:

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

         switch (i)
         {
            case 1:
               i++;
               return;

            case 1:   // CS0152, two case 1 statements
               i++;
               return;
         }
      }
   }
}