Navigation:  StyleCop 4.3 > StyleCop 4.3 Rules > Documentation Rules >

SA1644: DocumentationHeadersMustNotContainBlankLines

Previous pageReturn to chapter overviewNext page
StyleCop 4.3

Send comments on this topic.

SA1644: DocumentationHeadersMustNotContainBlankLines
Glossary Item Box
TypeName

DocumentationHeadersMustNotContainBlankLines

CheckId

SA1644

Category

Documentation Rules

 

Cause

A section within the Xml documentation header for a C# element contains blank lines.

Rule Description

C# syntax provides a mechanism for inserting documentation for classes and elements directly into the code, through the use of Xml documentation headers. For an introduction to these headers and a description of the header syntax, see the following article: http://msdn.microsoft.com/en-us/magazine/cc302121.aspx.

A violation of this rule occurs when the documentation header contains one or more blank lines within a section of documentation. For example:

  /// <summary>

  /// Joins a first name and a last name together into a single string.

  ///

   /// Uses a simple form of string concatenation.

  /// </summary>

  /// <param name="firstName">The first name to join.</param>

  /// <param name="lastName">The last name to join.</param>

  /// <returns>The joined names.</returns>

  public string JoinNames(string firstName, string lastName)

   {

      return firstName + " " + lastName;

   }

 

Rather than inserting blank lines into the documentation, use the <para> tag to denote paragraphs. For example:

  /// <summary>

  /// <para>

   /// Joins a first name and a last name together into a single string.

  /// </para><para>

   /// Uses a simple form of string concatenation.

   /// </para>

  /// </summary>

  /// <param name="firstName">The first name to join.</param>

  /// <param name="lastName">The last name to join.</param>

  /// <returns>The joined names.</returns>

  public string JoinNames(string firstName, string lastName)

   {

      return firstName + " " + lastName;

   }

 

How to Fix Violations

To fix a violation of this rule, remove the blank lines from the documentation header, and optionally replace them with <para/> tags.

 


© Microsoft Corporation. All Rights Reserved.