I have a better answer: FiXml.
Cloning comments with GhostDoc is certainly working approach, but it has significant disadvantages, e.g.:
- When the original comment is changed (which frequently happens during development),
its clone is not. - You’re producing huge amount of duplicates. If you’re using any
source code analysis tools (e.g. Duplicate Finder in Team City), it will
find mainly your comments.
Short description of FiXml: it is a post-processor of XML documentation produced by C# \ Visual Basic .Net. It is implemented as MSBuild task, so it’s quite easy to integrate it to any project. It addresses few annoying cases related to writing XML documentation in these languages:
- No support for inheriting the documentation from base class or interface. I.e. a documentation for any overridden member should be written from scratch, although normally it’s quite desirable to inherit at least the part of it.
- No support for insertion of commonly used documentation templates, such as “This type is singleton – use its
<see cref="Instance" />
property to get the only instance of it.”, or even “Initializes a new instance of<CurrentType>
class.”
To solve mentioned issues, the following additional XML tags are provided:
<inheritdoc />, <inherited />
tags<see cref="..." copy="..." />
attribute in<see/>
tag.
Here is its web page and download page (broken links).
Finally, there is <inheritdoc>
tag in Sandcastle – it’s definitely better to use it than to copy XML comments, but it has few disadvantages in comparison to FiXml:
- Sandcastle produces compiled HTML help files – it doesn’t modify
.xml
files
containing extracted XML comments. But these files are used by many tools,
including .NET Reflector and class browser \ IntelliSense in Visual Studio .NET.
So if you use just Sandcastle, you won’t see inherited documentation there. - Sandcastle’s implementation is less powerful. E.g. the is no
<see ... copy="true" />
.
See Sandcastle’s <inheritdoc>
description for further details.