Skip to content
ptittof57 edited this page Aug 15, 2015 · 6 revisions
<title>SA1511: WhileDoFooterMustNotBePrecededByBlankLine</title> <script src="script/helpstudio.js" type="text/javascript"></script> <script src="script/StandardText.js" type="text/jscript"></script>
<script type="text/jscript">WritePageTop(document.title);</script>

TypeName

WhileDoFooterMustNotBePrecededByBlankLine

CheckId

SA1511

Category

Layout Rules

Cause

The while footer at the bottom of a do-while statement is separated from the statement by a blank line.

Rule Description

To improve the readability of the code, StyleCop requires blank lines in certain situations, and prohibits blank lines in other situations. This results in a consistent visual pattern across the code, which can improve recognition and readability of unfamiliar code.

A violation of this rule occurs when the while keyword at the bottom of a do-while statement is separated from the main part of the statement by one or more blank lines. For example:

do

{

Console.WriteLine("Loop forever");

}

while (true);

How to Fix Violations

To fix a violation of this rule, remove any blank lines before the while keyword.

How to Suppress Violations

[SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1511:WhileDoFooterMustNotBePrecededByBlankLine", Justification = "Reviewed.")]
Clone this wiki locally