如何将方法描述的 XML 注释保留在单独的文件中?

发布于 2024-07-14 10:26:32 字数 601 浏览 4 评论 0原文

这个问题源于这个问题 代码文档多少算太多?

答案之一是保留您的 xml 文档位于单独的文件中。 我真的很喜欢这个答案,因为当我查看代码时,文档的冗长很烦人,另一方面,当通过智能感知搜索正确的方法或发布文档时,冗长的内容很有用。

答案是使用 include 标签

/// <include file="Documentation/XML/YourClass.xml" path="//documentation/members[@name='YourClass']/*"/>

还有一篇关于 include 标签的 MSDN 文章 这里。

我想出了如何保留摘要信息,但我不知道,也找不到如何将方法文档放在那里。 (这比课堂总结本身更重要。

This question stems from this question
Code documentation how much is too much?

One the answers was to keep your xml documentation in a separate file. I really liked that answer as when I am looking through the code the verbosity of the documentation is annoying, on the other hand that verbosity is usefull when searching for the right method via intellisense or publishing the documentation.

The answer was to use the include tag

/// <include file="Documentation/XML/YourClass.xml" path="//documentation/members[@name='YourClass']/*"/>

There is also a MSDN article about the include tag here.

I figured out how to keep the summary information out, but I do not know and I couldn't find it how to put the method documentation there as well. (which is more important than the class summary itself.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酷到爆炸 2024-07-21 10:26:32

答案很简单。 读取生成的 xml 文件。 他们给出了分离的 xml 文件应该是什么样子的想法。

读取生成的 xml 文件以及如何描述方法(带有参数等):

<member name="M:BitFactory.Logging.Logger.DoLog(BitFactory.Logging.LogEntry)">
    <summary>
    Really log aLogEntry. (We are past filtering at this point.)
    Subclasses might want to do something more interesting and override this method.
    </summary>
    <param name="aLogEntry">The LogEntry to log</param>
    <returns>true upon success, false upon failure.</returns>
</member>

T、M、F 前缀类型、方法、字段。

The answer is simple. Read the produced xml files. They give an idea how the separated xml files should look like.

Reading the produced xml files and how method is described (with parameters and such):

<member name="M:BitFactory.Logging.Logger.DoLog(BitFactory.Logging.LogEntry)">
    <summary>
    Really log aLogEntry. (We are past filtering at this point.)
    Subclasses might want to do something more interesting and override this method.
    </summary>
    <param name="aLogEntry">The LogEntry to log</param>
    <returns>true upon success, false upon failure.</returns>
</member>

T, M, F prefixes Type, Method, Field.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文