简体   繁体   中英

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) ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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