如何自动更正方法的 xml 文档

发布于 2024-08-05 09:11:34 字数 1621 浏览 6 评论 0原文

在 xml 文档中的以下代码中,方法参数中的参数名称与 xml 文档中的参数名称不匹配。有没有办法自动更正 xml 文档签名或 resharper 中提供的任何功能来自动更正 xml 文档。

#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

例如,我想要带有 xml 文档的方法,如下所示:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

始于初秋 2024-08-12 09:11:34

GhostDoc 将为您做这件事。安装后,您将在 VS 中获得一个新的上下文菜单项“记录此内容”(以及相应的键盘快捷键)。

如果不存在 XML 注释,它将添加它们。如果它们已经存在,则应根据您的要求进行更新。

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

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

独行侠 2024-08-12 09:11:34

我知道使用 R#“自动更正”xml 的唯一方法是删除现有的 xml 文档并再次点击 ///。抱歉我没有更好的答案。

我相信这是不可能的,因为 R# 不需要更正 xml 文档或方法签名。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文