SA1011: ClosingSquareBracketsMustBeSpacedCorrectly

StyleCop

TypeName

ClosingSquareBracketsMustBeSpacedCorrectly

CheckId

SA1011

Category

Spacing Rules

Cause

A closing square bracket within a C# statement is not spaced correctly.

Rule Description

A violation of this rule occurs when the spacing around a closing square bracket is not correct.

A closing square bracket must never be preceded by whitespace, unless it is the first character on the line.

A closing square bracket must be followed by whitespace, unless it is the last character on the line, it is followed by a closing bracket or an opening parenthesis, it is followed by a comma or semicolon, or it is followed by certain types of operator symbols.

How to Fix Violations

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