views:

274

answers:

2

In the below code in xml documentations there is mismatch between the names of parameters in method's arguments and name of parameters in xml documentation. Is there any way to auto correct the xml documentation signature or any feature provided in resharper to auto correct the xml documentation.

#region Get Images

/// <summary>
///  Get Images 
/// </summary>
/// <param name="par1"></param>
/// <param name="par2"></param>
/// <returns></returns>
public Collection<UserImage> GetImages()
{
    return GetImages("");
}

/// <summary>
///  Get Images 
/// </summary>
/// <param name="par1"></param>
/// <param name="par2"></param>
/// <returns></returns>
public Collection<UserImage> GetImages(string imageType)
{
    return GetImages(0, imageType);
}

/// <summary>
///  Get Images 
/// </summary>
/// <param name="par1"></param>
/// <param name="par2"></param>
/// <returns></returns>
public Collection<UserImage> GetImages(int imageId)
{
    return GetImages(imageId, "");
}

/// <summary>
///  Get Images 
/// </summary>
/// <param name="par1"></param>
/// <param name="par2"></param>
/// <returns></returns>
public Collection<UserImage> GetImages(int imageId,string imageType)
{
    return null;
}

#endregion

For example i want the method with xml documentation like this:

/// <summary>
///  Get Images 
/// </summary>
/// <param name="imageId"></param>
/// <param name="imageType"></param>
/// <returns></returns>
public Collection<UserImage> GetImages(int imageId,string imageType)
{
    return null;
}

#endregion
A: 

The only way I know to "auto correct" xml with R# is to delete the existing xml documentation and hit /// again. Sorry I don't have a better answer.

I believe it's not possible because R# doesn't what need to correct the xml documentation or method signature.

Vadim
+5  A: 

GhostDoc will do this for you. After installation you get a new context menu item in VS 'Document this' (and a corresponding keyboard shortcut).

If no XML comments are present, it will add them. If they are already present, they should get updated as you require.

http://submain.com/products/ghostdoc.aspx

AdamRalph
How does it know that xml documentation needs to be corrected and the arguments in the function?
Vadim
It looks at params elements, compares them to the arguments and updates if required. I've tried an example, it works well.
AdamRalph
Thanks,Adam it works well one thing more ,currently with that feature i have to go to each method and press CTRL+Shift+D to perform the xml documentation.Is there way to correct xml documentation all the methods in a class file?
Raghav Khunger
Unfortunately it seems that GhostDoc is not able to create/update the XML comments for more than one method at a time.
AdamRalph
If I remember the documentation correctly, it was left out on purpose: now you can review the autogenerated comments, which you will not do if there is a "document file" or "document project" option.
Hans Kesting
Ah true, I suppose it does force the casting of a human eye on the generated comments. Seems like a good idea.
AdamRalph