Skip to content

BRO1614: Generic type parameter documentation should declare parameter name

Every <typeparam> tag says which type parameter it documents. Replaces StyleCop SA1621.

Example

Before

/// <summary>A box.</summary>
/// <typeparam>The content type.</typeparam>
public class Box<T>
{
}

After

/// <summary>A box.</summary>
/// <typeparam name="T">The content type.</typeparam>
public class Box<T>
{
}

Why

A <typeparam> without a name doesn't show up in IntelliSense or the generated documentation; the text is lost.

How the fix works

Like BRO1612 for <param>: the fix adds the name when the type parameter is certain (the only unnamed tag and exactly one undocumented type parameter, or every tag unnamed with one per type parameter, named in order). It's fixed together with BRO1613's problems.

This rule reads documentation as XML, which needs <GenerateDocumentationFile>true</GenerateDocumentationFile>.

Not reported

  • When the type parameter isn't certain: the fix would have to guess.
  • Members whose documentation has a top-level <inheritdoc>, like StyleCop's SA1621. (Unnamed <param> tags are still BRO1612's there, like SA1613.)

Compared with StyleCop

StyleCop reports every unnamed tag and has no fix; StyleBro reports the ones it can name.