如何在我的构造函数中继承类的文档字符串

问题描述 投票:0回答:1

我有一个类来生成我用文档字符串记录的测试数据。

/// <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 ...
    }
}

类在这样的单元测试中使用:

var data = new NewUserData();

将鼠标悬停在

NewUserData
上不会显示 IDE(Visual Studio)中的文档字符串。有没有办法在不将文档字符串向下移动到构造函数的情况下实现这一点?

c# docstring code-documentation
1个回答
0
投票

发现可以使用 inheritdoc 标签实现这一点并将类名指定为 cref.

/// <inheritdoc cref="NewOwnerData"/>
var data = new NewUserData();
© www.soinside.com 2019 - 2024. All rights reserved.