Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 3) CS0642 

Error Message

Possible mistaken empty statement

A semicolon after a conditional statement may cause your code to execute differently than intended.

You can use /nowarn compiler option or #pragmas warning to disable this warning; see /nowarn (Suppress Specified Warnings) (C# Compiler Options) or #pragma warning (C# Reference) for more information.

The following sample generates CS0642:

// CS0642.cs
// compile with: /W:3
class MyClass
{
   public static void Main()
   {
      int i;

      for (i = 0; i < 10; i += 1);   // CS0642 semicolon intentional?
      {
         System.Console.WriteLine (i);
      }
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft