Can I refresh an XML comment in Visual Studio to r

2019-03-17 09:30发布

问题:

If I write the function:

    public static uint FindAUint(double firstParam)
    {

    }

I can generate the xml comments by typing '///', it gives :

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

    }

If I then decide I need to update my method to be:

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

    }

Is there a way to get visual studio to add the new params into the xml without losing the descriptions of the previous ones?

(I should mention I am using Visual Studio Express; I wouldn't put it past Microsoft to disallow the feature in the Express version though)

回答1:

Check out GhostDoc. It is a Visual Studio extension that will generate your XML comments for you.



回答2:

Resharper works very nice for me; it warns whenever the XML comment does not match a method's signature.

Also, using the ALT + ENTER keyboard shortcut resharper can fix these mismatches by adding/removing the necessary XML comments.