的Visual Studio:要重命名的类/字段/方法的时候得到更新的文档注释

问题描述:

我有一个类(C#编写)的一些文档注释:的Visual Studio:要重命名的类/字段/方法的时候得到更新的文档注释

/// <summary> 
/// Abstract class defining a tolerance-based method for Equals. 
/// Tolerance must be defined in a derived class like this: 
/// <code>class MyPrec : Precision { private MyPrec() : base(42) {} }</code> 
/// (This subclass will have a tolerance of 42.) 
/// </summary> 
public abstract class Precision 
{ 
    protected readonly double TOL; 

    protected Precision(double tol) 
    { 
     TOL = tol; 
    } 

    /// <summary> 
    /// Checks if two doubles are equal up to numerical tolerance given by TOL. 
    /// </summary> 
    /// <param name="left">First double.</param> 
    /// <param name="right">Second double.</param> 
    /// <returns>True if the absolute value of the difference is at most TOL, 
    ///   false otherwise.</returns> 
    public bool Equals(double left, double right) 
    { 
     return Math.Abs(left - right) <= TOL; 
    } 

    /// <summary> 
    /// Not Equals. 
    /// </summary> 
    public bool NotEquals(double left, double right) 
    { 
     return !Equals(left, right); 
    } 
} 

如果我在Equals方法通过重命名参数left Visual Studio的重命名功能,它也自动在文档评论中重新命名。但它似乎只适用于即时参数。

如何编写文档注释,以便在重命名相应的类/字段/方法时,以下单词也由Visual Studio更新?

  • 在类Precision

    /// <code>class MyPrec : Precision { private MyPrec() : base(42) {} }</code> 
    
  • TOL在方法Equals

    /// <returns>True if the absolute value of the difference is at most TOL, 
    
  • Equals在总结注释返回注释的总结注释的代码示例PrecisionNotEquals

    /// Not Equals. 
    

我使用Visual Studio 2015年

我已经尝试过

/// <returns>True if the absolute value of the difference is at most <paramref name="TOL"/>, 

,但它不工作。毕竟这不是输入参数。

+0

请发表您的相关问题,作为一个单独的问题。 –

  • 精度,我认为这是不可能的。 <代码>标记内的注释是一个自由文本。
  • 对于TOL和Equals,这很简单。当您在评论中引用其他代码成员时,请使用<see>标记。重命名将应用于这些元素。在你的情况的注释是:

    /// <returns>True if the absolute value of the difference is at most <see cref="TOL"/>, 
    

/// Not <see cref="Equals"/>.