Skip to content

doc-typeparam-has-name

C#styleno fixdefault: offcsharp/stylecop

Reports a <typeparam> without a name attribute, or with an empty one, in the documentation of a generic class, struct, interface, method or delegate. No fix.

The name connects the text to a type parameter. Without it the tag is not shown with its parameter.

To fix, add name="T".

Reported
using System.Threading.Tasks;
/// <summary>Generic.</summary>
/// <typeparam>No name.</typeparam>
/// <typeparam name="">Empty name.</typeparam>
...
/// <typeparam name="V">Good.</typeparam>
...
{
/// <summary>Method.</summary>
...
/// <typeparam>No name.</typeparam>
public void Method<X>() { }
/// <summary>Method.</summary>
/// <typeparam name="X"></typeparam>
...
public struct GenericStruct<T> { }
/// <summary>Interface.</summary>
/// <typeparam>T</typeparam>
public interface IGeneric<T> { }
/// <summary>Delegate.</summary>
...
csharp:
lint:
rules:
doc-typeparam-has-name: warn # off (default), warn, error

Enabled by the presets: csharp/stylecop.

Suppress one line with sudsy-disable-next-line doc-typeparam-has-name in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
StyleCop SA1621 full