Permalink
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (34 sloc) 1.03 KB

SA1007

TypeName SA1007OperatorKeywordMustBeFollowedBySpace
CheckId SA1007
Category Spacing Rules

Cause

The operator keyword within a C# operator overload method is not followed by any whitespace.

Rule description

A violation of this rule occurs when the operator keyword within an operator overload method is not followed by any whitespace. The operator keyword should always be followed by a single space. For example:

public MyClass operator +(MyClass a, MyClass b)
{
}

How to fix violations

To fix a violation of this rule, add a single space after the operator keyword.

How to suppress violations

[SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1007:OperatorKeywordMustBeFollowedBySpace", Justification = "Reviewed.")]
#pragma warning disable SA1007 // OperatorKeywordMustBeFollowedBySpace
#pragma warning restore SA1007 // OperatorKeywordMustBeFollowedBySpace