TypeName

OpeningCurlyBracketsMustBeSpacedCorrectly

CheckId

SA1012

Category

Spacing Rules

Cause

An opening curly bracket within a C# element is not spaced correctly.

Rule Description

A violation of this rule occurs when the spacing around an opening curly bracket is not correct.

An opening curly bracket should always be preceded by a single space, unless it is the first character on the line, or unless it is preceded by an opening parenthesis, in which case there should be no space between the parenthesis and the curly bracket.

An opening curly bracket must always be followed by a single space, unless it is the last character on the line.

How to Fix Violations

To fix a violation of this rule, ensure that the spacing around the opening curly bracket follows the rule described above.