BRO1512: While-do footer should not be preceded by blank line¶
The while of a do ... while follows the block directly. Replaces StyleCop SA1511.
Example¶
Before¶
public class Retry
{
public void Run(int times)
{
do
{
times--;
}
while (times > 0);
}
}
After¶
public class Retry
{
public void Run(int times)
{
do
{
times--;
}
while (times > 0);
}
}
Why¶
Separated from its block, the while reads like the start of a new loop.
How the fix works¶
The blank lines before while are removed.
Compared with StyleCop¶
Same positions and the same fixed output as StyleCop.