gpt4 book ai didi

c# - 如何在引用它的代码中使用外部库中的注释

转载 作者:行者123 更新时间:2023-12-02 22:05:52 26 4
gpt4 key购买 nike

Visual Studio/monodevelop 有一个很棒的功能,可以让你在每个函数/变量上方指定 xml 注释,然后当你滚动它、单击它等时,它会显示为该函数的描述。

    /// <summary>
/// This is example for stack overflow
/// </summary>
public void Foo()
{

}

这很酷,但它仅适用于您的本地代码(在 1 个项目内)我如何才能使外部库中函数中的这些注释在另一个项目中引用,并且在该项目中也可用?它应该是可能的,因为它适用于 .Net 程序集(当您引用 .Net 库时,您将能够看到该库中函数的这些描述)

最佳答案

您可以使用 visual studio 为您的库的文档生成 xml,查看它 here .

The Generate XML documentation file property determines whether an XML file will be generated during compilation. You set this property on the Compile page (for Visual Basic) or Build page (for Visual C#) of the Project Designer. When this option is selected, XML documentation is automatically emitted into an XML file, which will have the same name as your project and the .xml extension, Reference.

关于c# - 如何在引用它的代码中使用外部库中的注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16134120/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com