如何在.NET 中使用内联注释来记录成员?
如何在 .Net 中内联记录成员? 让我解释。 大多数从注释中提取文档的工具都支持某种内联文档,您可以在成员声明后添加简短的内容。 比如:
public static string MyField; /// <summary>Information about MyField.</summary>
有没有办法用 C# 或 .NET 语言来做到这一点?
How can I document a member inline in .Net? Let me explain. Most tools that extract documentation from comments support some kind of inline documentation where you can add a brief after the member declaration. Something like:
public static string MyField; /// <summary>Information about MyField.</summary>
Is there a way to do this in C# or the .NET languages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,你不能。 XML 注释仅支持块级注释,这意味着它必须放置在您正在记录的代码元素之前。 从 .NET 代码中提取 XML 注释的常用工具不知道如何解析这样的内联注释。 如果您需要这种能力,您将需要编写自己的解析器。
No, you can't. XML comments are only supported as a block level comment, meaning it must be placed before the code element you are documenting. The common tools for extracting XML comments from .NET code do not understand how to parse inline comments like that. If you need this ability you will need to write your own parser.
没有内置的方法可以做到这一点。 XML文档系统是分层的; 它定义了标签
和紧随其后的数据之间的关系。
There is not a built-in way to do this. The XML documentation system is hierarchical; it defines a relationship between the tag
<summary />
and the data that immediately follows it.是的,只需将其放在您要评论的内容之前即可
Yep, just put it BEFORE the thing you want to comment