TypeName

ClosingParenthesisMustBeSpacedCorrectly

CheckId

SA1009

Category

Spacing Rules

Cause

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

Rule Description

A violation of this rule occurs when the closing parenthesis within a statement is not spaced correctly.

A closing parenthesis should never be preceded by whitespace. In most cases, a closing parenthesis should be followed by a single space, unless the closing parenthesis comes at the end of a cast, or the closing parenthesis is followed by certain types of operator symbols, such as positive signs, negative signs, and colons.

If the closing parenthesis is followed by whitespace, the next non-whitespace character must not be an opening or closing parenthesis or square bracket, or a semicolon or comma.

How to Fix Violations

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