Navigation:  StyleCop 4.3 > StyleCop 4.3 Rules > Spacing Rules >

SA1000: KeywordsMustBeSpacedCorrectly

Previous pageReturn to chapter overviewNext page
StyleCop 4.3

Send comments on this topic.

SA1000: KeywordsMustBeSpacedCorrectly

Glossary Item Box

TypeName
KeywordsMustBeSpacedCorrectly

CheckId

SA1000

Category

Spacing Rules

 

Cause

The spacing around a C# keyword is incorrect.

Rule Description

A violation of this rule occurs when the spacing around a keyword is incorrect.

The following C# keywords must always be followed by a single space: catch, fixed, for, foreach, from, group, if, in, into, join, let, lock, orderby, return, select, stackalloc, switch, throw, using, where, while, yield.

The following keywords must not be followed by any space: checked, default, sizeof, typeof, unchecked.

The new keyword should always be followed by a space, unless it is used to create a new array, in which case there should be no space between the new keyword and the opening array bracket.

How to Fix Violations

To fix a violation of this rule, add or remove a space after the keyword, according to the description above.

 


© Microsoft Corporation. All Rights Reserved.