Skip to content
Christophe HEISER edited this page Aug 15, 2015 · 3 revisions
<title>SA1000: KeywordsMustBeSpacedCorrectly</title> <script src="script/helpstudio.js" type="text/jscript"></script> <script src="script/StandardText.js" type="text/jscript"></script>
<script type="text/jscript">WritePageTop(document.title);</script>

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.

How to Suppress Violations

[SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1000:KeywordsMustBeSpacedCorrectly", Justification = "Reviewed.")]
Clone this wiki locally