Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning (level 1) CS1522
Collapse the table of content
Expand the table of content

Compiler Warning (level 1) CS1522 

Error Message

Empty switch block

The compiler detected a switch block with no case or default statement. A switch block must have one or more case or default statements.

The following sample generates CS1522:

// CS1522.cs
// compile with: /W:1
using System;
class x
{
   public static void Main()
   {
      int i = 6;

      switch(i)   // CS1522
      {
         // add something to the switch block, for example:
         /*
         case (5):
            Console.WriteLine("5");
            return;
         default:
            Console.WriteLine("not 5");
            return;
         */
      }
   }
}

Community Additions

ADD
Show:
© 2015 Microsoft