dotnet / csharplang

The official repo for the design of the C# programming language
11.56k stars 1.03k forks source link

Xmldoc: allow reference to inherited member without qualification #2972

Open huoyaoyuan opened 5 years ago

huoyaoyuan commented 5 years ago

Currently, you have to qualify with the base class for the <see> here:

class Base
{
    public string P1 { get; }
}
class Derived : Base
{
    /// <summary>
    /// Combines the value of <see cref="Base.P1"/> with something
    /// </summary>
    public string P2 { get; }
}

It's not natural when the base property is desired to be frequently used with derived class instances.

And also at IDE side, always displaying the base class name will confuse user too. The user may expect the derived class as concrete.

https://github.com/ppy/osu-framework/pull/3006#discussion_r347150480

huoyaoyuan commented 5 years ago

Also, for consistency, nameof doesn't require such qualification.

class Base
{
    public string P1 { get; }
}
class Derived : Base
{
    [Obsolete("This does the same thing with " + nameof(P1))]
    public string P2 { get; }
}