我可以在Visual Studio中刷新XML注释以反映已更改的参数吗?

Nom*_*Sim 27 c# comments visual-studio-2010

如果我写这个函数:

    public static uint FindAUint(double firstParam)
    {

    }
Run Code Online (Sandbox Code Playgroud)

我可以通过输入'///'来生成xml注释,它给出:

    /// <summary>
    /// *Here I type the summary of the method*
    /// </summary>
    /// <param name="firstParam">*Summary of param*</param>
    /// <returns>*Summary of return*</returns>
    public static uint FindAUint(double firstParam)
    {

    }
Run Code Online (Sandbox Code Playgroud)

如果我然后决定我需要更新我的方法:

    /// <summary>
    /// *Here I type the summary of the method*
    /// </summary>
    /// <param name="firstParam">*Summary of param*</param>
    /// <returns>*Summary of return*</returns>
    public static uint FindAUint(double firstParam,double newParam, double newParam2)
    {

    }
Run Code Online (Sandbox Code Playgroud)

有没有办法让visual studio将新的参数添加到xml中而不会丢失之前的描述?

(我应该提到我正在使用Visual Studio Express;我不会过去通过Microsoft来禁止Express版本中的功能)

cad*_*ll0 13

看看GhostDoc.它是一个Visual Studio扩展,它将为您生成XML注释.

  • 它将删除不再存在的参数的注释,并添加任何缺失的注释.它不会覆盖任何东西.它还将生成方法,属性,参数等的默认描述. (7认同)

Cri*_*scu 5

Resharper对我来说非常好; 只要XML注释与方法的签名不匹配,它就会发出警告.

此外,使用ALT+ ENTER键盘快捷方式resharper可以通过添加/删除必要的XML注释来修复这些不匹配.

  • 我只看到这种方法的一个缺点; 如果方法在xml注释中没有任何<param>部分,即使方法中有参数,Resharper也不会建议添加缺少的参数.但无论如何,+1 :) (2认同)