0

In C# it is possible to add doc comments to methods. In the description it's possible to put a reference to another type using the <see cref="..."/> tag. When putting a generic type in the cref attribute I gather that I should use { and } instead of < and > in the cref attribute like this <see cref="Expression{T}" />. What should I put however if T is also a generic type? I tried <see cref="Expression{List{T}}" /> but Rider is telling me that is a syntax error.

Martin Brown
  • 24,692
  • 14
  • 77
  • 122
  • `Expression>` is not a class name, what do you want the readers to see? Though there is no error using `Expression{List{T}}` in Visual Studio. – shingo May 23 '23 at 10:57
  • @shingo ReSharper (same creators as Rider) shows "syntax error" for the latter. – CodeCaster May 23 '23 at 11:02

1 Answers1

1

AFAIK currently XML docs do not support constructed generic types - see this github issue. As workaround you can try something like:

/// This is <see cref="List{T}"/> where T is a <see cref="Action{T}"/>.
/// or
/// This is <see cref="List{T}"/> of <see cref="Action{T}"/>.
Guru Stron
  • 102,774
  • 10
  • 95
  • 132