c#xml对属性/评估者的评论

时间:2012-05-27 00:59:22

标签: c# .net xml-comments

是否可以为对象浏览器(VS 2010)中显示的set和get asssessors添加xml-comments?

        /// <summary>
        ///   Something abot property.
        /// </summary>

        public bool IsSomething
        {
              // get description

              get
              {
                    return isSomething;
              }

              // set description

              set
              {
                    // do some work
              }
        }

2 个答案:

答案 0 :(得分:7)

不,您无法直接在访问者上设置这些注释。然而,对该属性的评论可能非常全面,当您开始输入时,您将获得智能感知建议。如果您有扩展注释,您可能希望将额外的内容放在注释的备注部分中:

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

答案 1 :(得分:3)

不要这么想,至少不要在那个地方。我只想在其他现有标签中添加信息,如此

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