Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference a nested generic type in C# doc comments

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.

like image 923
Martin Brown Avatar asked Oct 16 '25 19:10

Martin Brown


1 Answers

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}"/>.
like image 179
Guru Stron Avatar answered Oct 18 '25 14:10

Guru Stron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!