Navigation:  StyleCop 4.3 > StyleCop 4.3 Rules > Layout Rules >

SA1507: CodeMustNotContainMultipleBlankLinesInARow

Previous pageReturn to chapter overviewNext page
StyleCop 4.3

Send comments on this topic.

SA1507: CodeMustNotContainMultipleBlankLinesInARow
Glossary Item Box
TypeName

CodeMustNotContainMultipleBlankLinesInARow

CheckId

SA1507

Category

Layout Rules

 

Cause

The C# code contains multiple blank lines in a row.

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 code contains more than one blank line in a row. For example:

  public bool Enabled

   {

      get

       {

          Console.WriteLine("Getting the enabled flag.");

 

 

          return this.enabled;

       }

   }

 

The code above would generate an instance of this violation, since it contains blank multiple lines in a row.

How to Fix Violations

To fix a violation of this rule, remove the extra blank lines.

 


© Microsoft Corporation. All Rights Reserved.