小编Eld*_*kki的帖子

我可以使用 <inheritdoc cref> 引用另一个变量的 XML 摘要吗?

When I'm writing functions for my project, and more specifically, their XML documentation comments, I find myself repeating the comments for a specific parameter often. This leads to misleading documentation sometimes (as copy pasting usually does...).

This is a simple example I thought of, which represents the real problem.

/// <summary>
/// The number that should be doubled
/// </summary>
private static float myNumber = 10f;

/// <summary>
/// Multiplies a number by 2
/// </summary>
/// <param name="number"><inheritdoc cref="myNumber"/></param> …
Run Code Online (Sandbox Code Playgroud)

c# documentation inheritdoc visual-studio

14
推荐指数
1
解决办法
3005
查看次数

标签 统计

c# ×1

documentation ×1

inheritdoc ×1

visual-studio ×1