-
Notifications
You must be signed in to change notification settings - Fork 22
SA1626
TypeName |
SingleLineCommentsMustNotUseDocumentationStyleSlashes |
CheckId |
SA1626 |
Category |
Documentation Rules |
The C# code contains a single-line comment which begins with three forward slashes in a row.
A violation of this rule occurs when the code contains a single-line comment which begins with three slashes. Comments beginning with three slashes are reserved for Xml documentation headers. Single-line comments should begin with only two slashes. When commenting out lines of code, it is advisable to begin the comment with four slashes to differentiate it from normal comments. For example:
/// <summary>
/// Joins a first name and a last name together into a single string.
/// </summary>
/// <param name="firstName">Part of the name.</param>
/// <param name="lastName">Part of the name.</param>
/// <returns>The joined names.</returns>
public string JoinNames(string firstName, string lastName)
{
A legal comment beginning with two slashes:
// Join the names together.
string fullName = firstName + " " + lastName;
An illegal comment beginning with three slashes:
/// Trim the name.
fullName = fullName.Trim();
A line of commented-out code beginning with four slashes:
////fullName = asfd;
return fullName;
}
To fix a violation of this rule, remove a slash from the beginning of the comment so that it begins with only two slashes.
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1626:SingleLineCommentsMustNotUseDocumentationStyleSlashes", Justification = "Reviewed.")]
- - 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