This question already has an answer here:
这个问题已经有了答案:
- How to reference generic classes and methods in xml documentation 7 answers
- 如何在xml文档7中引用泛型类和方法
As I know, in a XML comment for a C# type/method, it is possible to reference a generic type in a tag like so:
如我所知,在c#类型/方法的XML注释中,可以引用标记中的泛型类型如下:
///<see cref="name.space.typename<T&rt;(paramtype)">
But I think, there was another syntax, which is less clumsy? Something, to get rid of those html entities '<'? I cannot find it right now. Can somebody help?
但是我认为,还有另一种语法,不那么笨拙?要摆脱那些html实体的< ?我现在找不到。有人可以帮忙吗?
2 个解决方案
#1
61
Here's a good article on documentation: C# XML documentation comments FAQ
这里有一篇关于文档的好文章:c# XML文档注释FAQ
The compiler team decided to improve this by allowing an alternate syntax to refer to generic types and methods in doc comments. Specifically, instead of using the open and close angle-brackets it’s legal to use the open and close curly braces. The example above would then become:
编译团队决定通过允许另一种语法引用doc注释中的泛型类型和方法来改进这一点。特别地,与其使用左括号和右括号,不如使用左括号和右括号。上面的例子将变成:
class Program
{
/// <summary>
/// DoSomething takes a <see cref="List{T}"/>
/// </summary>
void DoSomething(List<int> al) { }
}
So, in your case:
所以,在你的情况:
///<see cref="name.space.typename{T}( paramtype )" />
#2
7
Use curly brackets:
使用花括号:
///<see cref="name.space.typename{T}(paramtype)">
#1
61
Here's a good article on documentation: C# XML documentation comments FAQ
这里有一篇关于文档的好文章:c# XML文档注释FAQ
The compiler team decided to improve this by allowing an alternate syntax to refer to generic types and methods in doc comments. Specifically, instead of using the open and close angle-brackets it’s legal to use the open and close curly braces. The example above would then become:
编译团队决定通过允许另一种语法引用doc注释中的泛型类型和方法来改进这一点。特别地,与其使用左括号和右括号,不如使用左括号和右括号。上面的例子将变成:
class Program
{
/// <summary>
/// DoSomething takes a <see cref="List{T}"/>
/// </summary>
void DoSomething(List<int> al) { }
}
So, in your case:
所以,在你的情况:
///<see cref="name.space.typename{T}( paramtype )" />
#2
7
Use curly brackets:
使用花括号:
///<see cref="name.space.typename{T}(paramtype)">