TypeName

OpeningParenthesisMustBeSpacedCorrectly

CheckId

SA1008

Category

Spacing Rules

Cause

An opening parenthesis within a C# statement is not spaced correctly.

Rule Description

A violation of this rule occurs when the opening parenthesis within a statement is not spaced correctly. An opening parenthesis should not be preceded by any whitespace, unless it is the first character on the line, or it is preceded by certain C# keywords such as if, while, or for. In addition, an opening parenthesis is allowed to be preceded by whitespace when it follows an operator symbol within an expression.

An opening parenthesis should not be followed by whitespace, 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 parenthesis follows the rule described above.