简体   繁体   English

属性/访问器的 XML 注释

[英]XML comments for properties / accessors

Is it possible to add XML comments for set and get accessors which will be visible in Object Browser (VS 2010) ?是否可以为setget访问添加XML 注释,这些访问器将在对象浏览器(VS 2010)中可见?

/// <summary>
/// Something about property.
/// </summary>

public bool IsSomething
{
    // get description

    get
    {
        return isSomething;
    }

    // set description

    set
    {
        // do some work
    }
}

No, you cannot set these comments directly on the accessors.不,您不能直接在访问器上设置这些注释。 The comments on the property, however, can be quite comprehensive, you will get IntelliSense suggestions when you start to type them.但是,对属性的评论可能非常全面,当您开始键入它们时,您将获得 IntelliSense 建议。 If you have extended comments, you might want to put the extra stuff in the remarks section of the comment:如果您有扩展评论,您可能希望将额外的内容放在评论的备注部分:

/// <summary>
///   Something about the property.
/// </summary>
/// <remarks>
/// Some extra remarks that won't show up in the property's IntelliSense later.
/// </remarks>

Don't think so, at least not in that location.不要这么认为,至少不是在那个位置。 I would just add the info inside of other existing tags, like so:我只想在其他现有标签中添加信息,如下所示:

/// <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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM