Export (0) Print
Expand All
Expand Minimize

Compiler Error CS1523

Visual Studio .NET 2003

The keyword case or default must precede code in switch block

Code was found in a switch statement that was part of neither a case nor a default block.

The following sample generates CS1523:

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

      switch (i)
      {
         i = 6;   // CS1523, code not under a label
         // try the following
         /*
         default:
            i = 6;
         */
      }
   }
}
Show:
© 2015 Microsoft