c# - 有没有办法使用在一个?
- ?
问题描述
我正在使用 XML 标记来记录我的程序,因此当我将鼠标悬停在我的类、方法等上时,我可以看到描述。我想在我的一个类上显示一个列表,如下所示:
/// <remarks>
/// <b>List of methods below</b>
/// <list type="table">
/// <listheader>
/// <term>
/// <see cref="MyMethod()"/>
/// </term>
/// <description>
/// <inheritdoc cref="MyMethod()"/>
/// </description>
/// </listheader>
/// </list>
/// </remarks>
public class MyClass
{
/// <summary>
/// Description of MyMethod()
/// </summary>
public void MyMethod()
{
// Do something
}
}
问题是 <inheritdoc /> 没有在预览中加载任何内容。但是,当我以完全相同的格式将 <inheritdoc /> 移到 <list> 之外时,它会完美显示。有没有办法在列表中引用 MyMethod() 的描述?
解决方案
<inheritdoc>
默认情况下包括目标 XML 注释中的所有成员。如果您需要,<summary>
您需要使用path
属性选择它:
<inheritdoc cref="MyMethod" path='//summary/text()'/>
它应该呈现如下内容:
推荐阅读
- c# - 如何选择异步委托的返回类型
- r - R如何用多个if else条件向量化一个函数
- arrays - 如何组织列表列表以与 scipy.optimize fmin init 数组兼容
- javascript - 如何设置 React Modal 边框半径
- .net-core - .net core 3 jwt token 配置部署linux
- javascript - 在 VUE 模板中动态传递所有对象的键和值作为 HTML 属性
- python - Pylint 说:W0233:来自非直接基类“嵌套”的 __init__ 方法被调用(非父初始化调用)
- powershell - ls 进入解压目录
- swift - 如何实现一个自定义属性包装器,它将发布 SwiftUI 的更改以重新呈现它的视图
- c++ - 为什么我们在链表中设置pointer=nullpointer和pointer->next=nullpointer时会有不同的效果-C++