[英]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.