Total .NET Analyzer Rule Documentation  

EmptyWhile Rule

Review empty While statements.

Remarks

While statements execute a statement or block of statements until a given expression evaluates to a given False. By having no code in a While statement, you are not executing any code in the loop.

For instance, the following code has an empty While statement:


' VB
While counter > 10

End While

//C#
while (counter > 10);
{

}



In general, empty While statements do not serve a purpose, and should be removed.

Resolution

Review empty While statements to determine whether they represent undone work, contain commented code that should be enabled, or do nothing and should be removed.

See Also

While Statements (VB)

While Statements (C#)