我几乎可以肯定这将是一个非常简单的答案,但我似乎在任何地方都找不到。我们都知道,当您将鼠标悬停在某个内容(例如字符串)上时,会弹出一个小摘要(如果已启用)。对于字符串,它说:
类System.String
将文本表示为一系列Unicode字符。
[当我将鼠标移到my类之一时,它只是说:
类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插件之一。
三斜杠XML注释可用于在Visual Studio中创建IDE工具提示。特别是“摘要”和“例外”效果很好。 (其他类似“代码”的东西在我使用的Visual Studio版本中不起作用。)
在Visual Studio中重置您的设置,它们似乎被弄乱了。为了显示它,您必须使用第一个示例。
[您需要使用第一种语法,如果您使用的是Visual Studio解决方案之外的类,则需要在“项目属性”中选中“生成XML文档”。