Inherit documentation in C#?

烈酒焚心 提交于 2019-12-03 01:14:39

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

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

Bob

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

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

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)

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).

Kumar

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#

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