是否可以为set
和get
访问器添加xml注释,这些访问器将在对象浏览器(VS 2010)中可见?]
/// <summary>
/// Something about property.
/// </summary>
public bool IsSomething
{
// get description
get
{
return isSomething;
}
// set description
set
{
// do some work
}
}
否,您不能直接在访问器上设置这些注释。但是,对该属性的评论可能非常全面,当您开始键入它们时,您将获得智能建议。如果您有更多评论,则可能需要在评论的备注部分中添加其他内容:
/// <summary>
/// Something about 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 wolrd ends</remarks>