<分区>
据我所知,在 C# 类型/方法的 XML 注释中,可以像这样在标记中引用泛型类型:
///<see cref="name.space.typename<T&rt;(paramtype)">
但我认为,还有另一种语法,它不那么笨拙?什么,摆脱那些 html 实体 '<'?我现在找不到它。有人可以帮忙吗?
<分区>
据我所知,在 C# 类型/方法的 XML 注释中,可以像这样在标记中引用泛型类型:
///<see cref="name.space.typename<T&rt;(paramtype)">
但我认为,还有另一种语法,它不那么笨拙?什么,摆脱那些 html 实体 '<'?我现在找不到它。有人可以帮忙吗?
最佳答案
这里引用了一篇不再可用的关于文档的好文章:
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:
class Program
{
/// <summary>
/// DoSomething takes a <see cref="List{T}"/>
/// </summary>
void DoSomething(List<int> al) { }
}
因此,在您的情况下:
///<see cref="name.space.typename{T}(paramtype)"/>
以下是来自 Microsoft 的一些较新的引用资料:
关于c# - 在 XML 代码注释中引用泛型类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5030091/