Edit

Share via


Compiler Warning (level 3) CS0642

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 (C# Compiler Options) or #pragma warning 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);  
      }  
   }  
}