.NET xml文档 - 继承文档 [英] .NET xml docs - inheriting documentation

查看:108
本文介绍了.NET xml文档 - 继承文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NDoc具有一个XML元素 inheritdoc ,它允许您从父类(或已实现的接口)继承成员的文档。但是,Visual Studio(即C#编译器)不了解此标签,并抱怨文档不存在或不完整。 StyleCop和其他一些工具也是如此。有替代方法吗?

NDoc has an XML element inheritdoc which allows you to inherit documentation of a member from the parent class (or an implemented interface). However, Visual Studio (i.e. the C# compiler) does not understand this tag and complains about the documentation not being present or complete. So does StyleCop and some other tools. Is there an alternative approach? How do you go about keeping the docs complete, yet without duplicating the XML descriptions?

推荐答案

另一种方法是使用 GhostDoc - 一个为您自动生成评论的Visual Studio的加载项。这当然是复制了XML描述,这是您尝试避免的一部分 - 但至少它会自动为您而设。

One alternative is to use GhostDoc - an add-in for Visual Studio that automatically generates comments for you. This duplicates the XML description of course, which is part of what you're trying to avoid - but at least it does it automatically for you.

如果您只是离开文档完全是为了继承的方法或覆盖的接口方法?我怀疑这取决于您如何配置NDoc,但肯定在MSDN文档中似乎只是自然地继承了文档 - 并且快速检查建议,VS不会在不产生时产生docs为继承方法。值得一试,肯定。

What happens if you just leave off the docs entirely for methods which are being inherited, or overriding interface methods? I suspect it depends on how you've got NDoc configured, but certainly in MSDN documentation seems to just naturally inherit the docs - and a quick check suggests that VS won't whinge when you don't prodive docs for an inherited method. Worth a try, certainly.

这篇关于.NET xml文档 - 继承文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆