[英]XML comments for properties / accessors
是否可以為set
和get
訪問器添加XML 注釋,這些訪問器將在對象瀏覽器(VS 2010)中可見?
/// <summary>
/// Something about property.
/// </summary>
public bool IsSomething
{
// get description
get
{
return isSomething;
}
// set description
set
{
// do some work
}
}
不,您不能直接在訪問器上設置這些注釋。 但是,對屬性的評論可能非常全面,當您開始鍵入它們時,您將獲得 IntelliSense 建議。 如果您有擴展評論,您可能希望將額外的內容放在評論的備注部分:
/// <summary>
/// Something about the property.
/// </summary>
/// <remarks>
/// Some extra remarks that won't show up in the property's IntelliSense later.
/// </remarks>
不要這么認為,至少不是在那個位置。 我只想在其他現有標簽中添加信息,如下所示:
/// <summary>
/// Gets or sets the x.
/// </summary>
/// <value>
/// The x.
/// </value>
/// <returns> this saves the world</returns>
/// <remarks> when you set this the world ends</remarks>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.