覆盖属性的XML注释

Mic*_*yan 8 c# overriding properties monodevelop unity-game-engine

我正在使用MonoDevelop 2.4.2 for OS X(Unity 3.4.1附带的版本),并且想知道是否有某种方法可以从基类或属性继承注释.

例:

public class Foo
{
    /// <summary>
    /// The describes the ABC property
    /// </summary>
    public virtual int ABC
    {
        get { return _abc; }
        set { _abc = value; }
    }
    protected int _abc;

    /// <summary>
    /// The describes the XYZ property
    /// </summary>
    public virtual int XYZ
    {
        get { return _xyz; }
        set { _xyz = value; }
    }
    protected int _xyz;
}

public class Bar : Foo
{
    public override int ABC
    {
        set
        {
            // DO SOMETHING
            base.ABC = value;
        }
    }
}

Bar bar = new Bar();

// In MonoDevelop 2.4.2 (OS X), the ABC property doesn't show the comments
// in the autocomplete popup or when you hover the mouse over the property.
int abc = bar.ABC;

// ... but they do show up for XYZ, because it doesn't override
int xyz = bar.XYZ;
Run Code Online (Sandbox Code Playgroud)

这个问题看起来有点类似于 C#的注释继承(实际上是任何语言),尽管我现在主要关注它们在编辑器中的行为方式,这是MonoDevelop特有的.

该问题中的一些解决方案涉及<inheritdoc />,它在MonoDevelop中似乎没有效果(或者我误用了它),Ghostdoc用于Visual Studio.

似乎唯一的解决方案是在继承的类中复制属性注释.还有其他选择吗?

ess*_*kar 1

我无法真正确认这一点,但曾经有一个名为 DocFood 的插件,现在是 MonoDevelop 的一部分(我认为最新版本是 2.8.*)。尝试一下,我认为它可以继承父实现的注释。