实现类可以“继承”吗? 来自其实现的接口的 XML 注释?

发布于 2024-07-16 06:57:29 字数 134 浏览 5 评论 0原文

好奇的问题。 我正在使用 Microsoft 的 Sandcastle 从 C# 代码中的 XML 注释生成文档。 我的几个类正在实现已经具有注释方法的接口。 我不想在接口方法和公共实现方法中重复文档。 我可以使用某种标签从界面“继承”此文档吗?

Curious question. I'm using Microsoft's Sandcastle to generate documentation from the XML comments in my C# code. Several of my classes are implementing interfaces which already have commented methods. I'd rather not duplicate the documentation in both the interface method and the public implemented method. Is there some kind of tag I can use to "inherit" this documentation from the interface?

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

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

发布评论

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

评论(3

蓦然回首 2024-07-23 06:57:29

您可以在实现中添加

您应该看看以下线程:
C# 中同步接口和实现注释的方法

You can add <inheritdoc/> in the implementation.

You should have a look on the following thread:
Ways to synchronize interface and implementation comments in C#

依 靠 2024-07-23 06:57:29

Visual Studio 目前不存在此功能。

您可以获得第三方工具,例如 GhostDoc,它将有助于创建 XML 文档。 GhostDoc 还可以选择生成“继承”的文档,就像您尝试做的那样。

链接:GhostDoc

This feature does not exist currently in Visual Studio.

You can get third party tools, such as GhostDoc that will help with creating XML documentation. GhostDoc also has the option to generate documentation that was "inherited" like you are attempting to do.

Link: GhostDoc

土豪 2024-07-23 06:57:29

为了防止其他人正在寻找解决方案,我构建了一个库来对 XML 文档文件进行后处理,以添加对的支持。 标签。

更多信息请访问 www.inheritdoc.io(提供免费版本)。

In case anyone else is looking for a solution, I built a library to post-process the XML documentation files to add support for an <inheritdoc/> tag.

More info at www.inheritdoc.io (free version available).

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