首页 > 解决方案 > 在带有 XML 文档的 Visual Studio 中:如何引用其他参数?

问题描述

(就我而言,我正在 Visual Studio Community 2019 中编写 C# 代码以在 Unity 中使用。)

我根本找不到任何方法来做到这一点,除非我想通过学习如何编写自己的 Visual Studio 扩展来解决问题,所以在这里我问:

问题: 在编写例如 a 时<param>,是否可以简单地告诉它使用 another <param>

示例: 例如,采取以下代码:

public class TextClass
{
    Vector3 pos;
    Vector3 rot;

    ///<summary> Moves the object. </summary>
    ///<param name="newPos"> The new position of the object. </param>
    public void Move(Vector3 newPos)
    {
        pos = newPos;
    }

    ///<summary> Moves the object. </summary>
    ///<param name="newPos"> The new position of the object. </param>
    ///<param name="newRot"> The new rotation of the object. </param>
    public void Move(Vector3 newPos, Vector3 newRot)
    {
        pos = newPos;
        rot = newRot;
    }
}

对于这两个Move功能,都具有“移动对象”。作为摘要和“对象的新位置”。作为. param_ newPos我非常希望能够告诉第一个移动函数只使用param第二个Move函数的摘要和。

标签: c#visual-studiovisual-studio-extensionsxml-documentation

解决方案


这就是inheritdoc可以用来做的事情。您可以让您的第一个 Move 函数使用它来继承第二个 Move 函数的文档。


推荐阅读