How can I inherit the docstring of the class in my constructor

59 Views Asked by At

I have a class to generate test data that I have documented with a docstring.

/// <summary>
/// In this scenario the user is new to the group, but may have existed from before.
/// </summary>
class NewUserData {
    public User user;
    // More data fields here ...

    public NewUserData(){ 
        // Creating test data here ...
    }
}

The class is used in a unit test like this:

var data = new NewUserData();

Hovering over NewUserData doesn't show me the docstring in IDE (Visual Studio). Is there a way to make this happen without moving the docstring down to the constructor?

1

There are 1 best solutions below

0
Stian Jørgensrud On

Found out one can achieve this with the inheritdoc tag and specify the class name as cref.

/// <inheritdoc cref="NewUserData"/>
var data = new NewUserData();