Total .NET Analyzer Rule Documentation |
|
Review empty For statements.
Remarks
For statements execute a statement or group of statements a specified number of times. By having no code in a For statement, you are not executing any code in the loop.
For instance, the following code has an empty For statement:
' VB
For counter = 0 To timesToExecute
Next counter
//C#
for (int counter = 0; counter < timesToExecute; counter++)
{
}
In general, empty For statements do not serve a purpose, and should be removed.
Resolution
Review empty For statements to determine whether they represent undone work, contain commented code that should be enabled, or do nothing and should be removed.
See Also
For Statements (VB)
For Statements (C#)