Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0152

The label 'label' already occurs in this switch statement

A label was repeated in a switch statement.

The following sample generates CS0152:

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

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

            case 1:   // CS0152, two case 1 statements
               i++;
               return;
         }
      }
   }
}
Show:
© 2014 Microsoft