我對OS X(Unity 3.4.1附帶的版本)使用MonoDevelop 2.4.2,並且想知道是否有某種方法來繼承基類或屬性的註釋。覆蓋屬性的XML註釋
例子:
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;
這個問題似乎有點類似 Comment Inheritance for C# (actually any language),雖然我最關注的,他們在此時編輯器的行爲,這是特定於MonoDevelop中。
該問題中的一些解決方案涉及到< inheritdoc/>,它在MonoDevelop中(或者我濫用它)似乎不是有效的,而Ghostdoc是針對Visual Studio的。
看來唯一的解決方案是複製繼承類中的屬性註釋。有沒有其他的選擇?
我會爲// Do Something改寫OnABCChanged()函數。 – CodingBarfield