c# - 在 XML 代码注释中引用泛型类型

标签 c# xml documentation reference generics

<分区>

据我所知,在 C# 类型/方法的 XML 注释中,可以像这样在标记中引用泛型类型:

///<see cref="name.space.typename&lt;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/

相关文章:

c# - 复杂匿名对象到动态公共(public)属性

c# - 寻找列表中元素的最佳位置

php - 如何在 doxygen 文档中包含文件夹?

c# - PictureBox.Handle Intptr 到图像或位图

c# - MvcHttpHandler 似乎没有实现 IHttpHandler

java - 解码 XML 数据中的 <br/>

xml - 如何在rest API Flutter中发布/发送XML数据而不是JSON?

c# - 使用 LINQ to XML 解析深层嵌套属性时遇到问题

documentation - Slate vs Swagger-哪个更好,哪个有更多选择?

c# - 支持文档中包含哪些核心元素?