Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I refresh an XML comment in Visual Studio to reflect parameters that have changed?

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)

like image 257
NominSim Avatar asked May 04 '12 15:05

NominSim


People also ask

How do I auto generate comments in Visual Studio?

Just hit (by default) Ctrl+D anywhere within a method, and it will add XML Documentation comments with defaults filled in (though they typically should be modified/expanded).

How do you add comments in XML?

An XML comment encountered outside the document type declaration is represented by the Comment value syntax element. It contains the comment text from the XML message. If the value of the element contains the character sequence --> , the sequence is replaced with the text --&gt; .

What symbols are needed for an XML comment in Visual Studio?

The syntax for adding XML comments in your code is triple slashes /// followed by one of the supported XML tags.


2 Answers

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

like image 183
cadrell0 Avatar answered Oct 17 '22 19:10

cadrell0


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.

like image 5
Cristian Lupascu Avatar answered Oct 17 '22 17:10

Cristian Lupascu