-
Notifications
You must be signed in to change notification settings - Fork 22
SA1023
TypeName |
DereferenceAndAccessOfMustBeSpacedCorrectly |
CheckId |
SA1023 |
Category |
Spacing Rules |
A dereference symbol or an access-of symbol within a C# element is not spaced correctly.
A violation of this rule occurs when the spacing around a dereference or access-of symbol is not correct.
The spacing around the symbol depends upon whether the symbol is used within a type declaration. If so, the symbol must always be followed by a single space, unless it is the last character on the line, or is followed by an opening square bracket or a parenthesis. In addition, the symbol should not be preceded by whitespace, and should not be the first character on the line. An example of a properly spaced dereference symbol used within a type declaration is:
object* x = null;
When a dereference or access-of symbol is used outside of a type declaration, the opposite rule applies. In this case, the symbol must always be preceded by a single space, unless it is the first character on the line, or is preceded by an opening square bracket, a parenthesis or a symbol of the same type i.e. an equals. The symbol should not be followed by whitespace, and should not be thelast character on the line. For example:
y = *x;
To fix a violation of this rule, ensure that the spacing around the dereference or address-of symbol follows the rule described above.
[SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1023:DereferenceAndAccessOfMustBeSpacedCorrectly", Justification = "Reviewed.")]
</div>
</div>
- - SA0102 - Clean Install
- - Download
- - Documentation Rules - Layout Rules - Maintainability Rules - Naming Rules - Ordering Rules - Readability Rules - Spacing Rules - Suppressions
- - Adding a custom StyleCop settings page - Adding custom rule settings - Authoring a custom styleCop rule - Authoring rules metadata - Custom CSharp Language Service - Custom MSBuild Integration - Hosting StyleCop in a Custom Environment - Installing a Custom Rule - Integrating StyleCop Into Build Environments - Integrating StyleCop into MSBuild - Writing Custom Rules for StyleCop