-2

例如:

interface IDottable : IGetDottable
{
    bool try_dot_operator(string name);
    // ... more methods
    IDottable Dottable => this;
}
interface IGetDottable
{
    IDottable Dottable {get;}
}

它给了我:

"'IDottable.Dottable' hides inherited member 'IGetDottable.Dottable'. Use the new keyword if hiding was intended.".
4

1 回答 1

1

尝试这个:

interface IDottable : IGetDottable
{
     bool try_dot_operator(string name);
     // ... more methods
     IDottable IGetDottable.Dottable => this;
}
interface IGetDottable
{
    IDottable Dottable {get;}
}

接口中的默认实现不会公开该方法。

于 2021-05-25T00:21:23.840 回答