Inherit comments from a virtual object

2

How can I inherit comments within the tag <summary> of an object?

I have the following class:

class BASE
{
    /// <summary>
    /// String de Conexão a base de dados.
    /// </summary>
    public virtual string CONN { get; set; }

    /// <summary>
    /// Carregar DataTable do Modelo.
    /// </summary>
    /// <param name="Select">Select do Modelo.</param>
    /// <returns></returns>
    public virtual DataTable LOAD(string Select) => new DataTable();
}

When I create new classes from it, they do not inherit comments through override Ex:

class SQL : BASE
{
    public override string CONN { get => base.CONN; set => base.CONN = value; }

    public override DataTable LOAD(string Select)
    {
        return base.LOAD(Select);           
    }
}
    
asked by anonymous 16.03.2018 / 13:17

2 answers

3

With ReSharper (and other tools possible), you can replicate the comment with Alt + Enter in the setting, you will have a choice to copy the base documentation.

Even with this possibility, be aware that when you are overwriting a method it no longer does what the table of contents said, even if it calls your base later. The correct thing is to make a new summary telling you what your method does.

    
16.03.2018 / 14:08
2

You also have the possibility to inherit the documentation as you wish. To do this use the <inheritdoc cref=""/> .

Example:

/// <inheritdoc cref="object.ToString"/>
    
16.03.2018 / 17:20