SA1509 - Visual-Stylecop/Visual-StyleCop GitHub Wiki

<title>SA1509: OpeningCurlyBracketsMustNotBePrecededByBlankLine</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

OpeningCurlyBracketsMustNotBePrecededByBlankLine

CheckId

SA1509

Category

Layout Rules

Cause

An opening curly bracket within a C# element, statement, or expression is preceded 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 an opening curly bracket is preceded by a blank line. For example:

public bool Enabled

{

get

{

return this.enabled;

}

}

The code above would generate two instances of this violation, since there are two places where opening curly brackets are preceded by blank lines.

How to Fix Violations

To fix a violation of this rule, remove the blank line preceding the opening curly bracket.

How to Suppress Violations

[SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1509:OpeningCurlyBracketsMustNotBePrecededByBlankLine", Justification = "Reviewed.")]
⚠️ **GitHub.com Fallback** ⚠️