Question

Is there a way (tool, or something) that permits do not duplicate the same XML comments when inheriting/Overriding methods from the base classes?

Eg.:

/// <summary>
/// Represent a brand new object in .NET
/// </summary>
public class MyObject : Object
{
    /// <summary>
    /// Copy-Paste the same Xml comment 
    /// like in the base class is boring!
    /// </summary>
    /// <param name="obj">and params too!! ((</param>
    /// <returns>this one too!!! (((</returns>
    public override bool Equals(object obj)
    {
        return base.Equals(obj);
    }
}
Was it helpful?

Solution

I think you're looking for inheritdoc:

/// <inheritdoc />
public override bool Equals(object obj)

This is not a standard tag (so Intellisense may not support it, for exampple), but it's pretty commonly used - in particular, Sandcastle supports it.

OTHER TIPS

If you are looking for a tool, you can try GhostDoc extension for visual studio. It helps you pre-generating comments and can take comments from base class.

As the generated comment is a regular comment, IntelliSense supports it properly but it's not magically updated when the base comment is changed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top