Inherit documentation in C#?

↘锁芯ラ 提交于 2019-12-03 10:45:30

问题


From Java and Eclipse I'm used to @inheritDoc that allows to use the same documentation as in the base class/method.

How can I accomplish something similar in C# and Visual Studio 2010?


回答1:


It doesn't exist in vanilla VS. Your best bet is ghostdoc or similar. This is available in the Extension Manager, or here




回答2:


Even this question is a few years old and it was specifically for Visual Studio 2010. For all those that land here by Google, I would like to add an answer that I found and that holds true for Visual Studio 2015 in combination with Sandcastle Help File Builder (SHFB):

/// <inheritdoc/>

can be used to inherit the docs from a base class or an interface.

Here a link to the Sandcastle Help File Builder (SHFB) documentation: Using the <inheritdoc /> Tag




回答3:


ReSharper not only provides shortcut keys to copy base class comments, but it actually includes <inheritdoc> comments in its custom intellisense the way you want. This only works if your whole team is using ReSharper of course. Usage of <inheritdoc> is explained well here




回答4:


Resharper provides shortcuts to copy the XML documentation from base classes.




回答5:


My addin, AtomineerUtils will duplicate documentation from overrides of base class and interface methods/properties, from overloads in the same class, and for parameters it will also look for same-named parameters used elsewhere in the same class.

You may also be able to use extension XML commands like <inheritdoc> or <include> if you want to duplicate the text in external documentation (Sandcastle, Doxygen, etc), but I'm not aware of any way of "dynamically" inheriting documentation for "internal" use (intellisense etc)




回答6:


I ended up creating a tool to add support for replacing the <inheritdoc/> tag by post-processing the XML documentation files. Available at www.inheritdoc.io (free version available).




回答7:


NDoc3.

NDoc3 is based on NDoc, and is a code documentation generation tool for .NET developers. The goal is to make a fast, extensible, multi-platform .NET documentation tool which supports all of the .NET languages specifications including but not only, C#



来源:https://stackoverflow.com/questions/5304168/inherit-documentation-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!