相关疑难解决方法(0)

将常量渲染到XML文档中?

我有2个私有consts和一个公共方法:

private const byte _minAge = 24;
private const byte _maxAge = 29;

public bool IsInAgeRange() { ... }
Run Code Online (Sandbox Code Playgroud)

我正在添加XML文档,如果我的代码的用户可以在IntelliSense中读取它,我希望它是最好的: Checks whether the age is within the allowed range (between 24 and 29).

我的问题是:有没有办法将我的consts渲染到我的XML文档中?


我提出的替代方案是:

  1. 只需在文档中写入24和29(缺少对实际值的依赖)
  2. 使consts公开并添加<see cref="MinAge"><see cref="MaxAge">(减少封装并使文档信息量减少)

c# xml-documentation visual-studio

28
推荐指数
3
解决办法
3633
查看次数

标签 统计

c# ×1

visual-studio ×1

xml-documentation ×1