我几乎可以肯定这将是一个非常简单的答案,但我似乎无法在任何地方找到它。我们都知道,当您将鼠标悬停在某物(如字符串)上时,会弹出一个小摘要(如果启用)。对于一个字符串,它说:
class System.String
Represents text as a series of Unicode characters.
当我将鼠标悬停在我的 类(class)之一上时,它只是说:
class Namespace.Widget
我已经尝试了我发现的两个明显的例子:
/// <summary>
/// This summary does not work, I know it's for html documenting tools but thought it was worth a shot.
/// </summary>
和:
// Summary:
// This is what is in some of the base libraries, and does not work as well.
那么,如何向鼠标悬停弹出窗口添加摘要?
最佳答案
我不明白为什么您的第一次尝试行不通。这是 <summary>
提供您正在谈论的“工具提示”的注释标签...
/// <summary>
/// This text should automatically show up as the summary when hovering over
/// an instance of this class in VS
/// </summary>
public class MyClass
{
public MyClass() {}
}
public class MyClass2
{
public MyClass()
{
//hovering over 'something' below in VS should provide the summary tooltip...
MyClass something = new MyClass();
}
}
如果您需要帮助自动执行某些评论,请尝试免费的 GhostDoc .迄今为止最好的免费 VS 插件之一..
关于c# - 如何添加鼠标悬停摘要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2284001/