Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can implementation classes "inherit" XML comments from their implemented interfaces?

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?

like image 248
Jordan Parmer Avatar asked Apr 06 '09 16:04

Jordan Parmer


People also ask

What are XML comments in c#?

C# documentation comments use XML elements to define the structure of the output documentation. One consequence of this feature is that you can add any valid XML in your documentation comments. The C# compiler copies these elements into the output XML file.

What is Inheritdoc C#?

This allows you to inherit documentation from base class libraries without having to add them as documentation assemblies in your project.


2 Answers

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#

like image 140
Benoit Blanchon Avatar answered Nov 15 '22 23:11

Benoit Blanchon


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

like image 27
jgallant Avatar answered Nov 15 '22 23:11

jgallant