如何添加鼠标悬停摘要
我几乎可以肯定这将是一个非常简单的答案,但我似乎无法在任何地方找到它。我们都知道,当您将鼠标悬停在某物(例如字符串)上时,会弹出一个小摘要(如果已启用)。对于字符串,它表示:
系统字符串类
将文本表示为一系列 Unicode 字符。
当我将鼠标悬停在我的一个类上时,它只是说:
类命名空间.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.
那么,如何向鼠标悬停弹出窗口添加摘要?
I'm almost certain this is going to be a very simple answer but I can't seem to find it anywhere. We all know when you hover your mouse over something (like a string) a little summary pops up (if its enabled). For a string, it says:
class System.String
Represents text as a series of Unicode characters.
When I mouse over one of my classes, it simply says:
class Namespace.Widget
I've tried the two obvious examples I've found:
/// <summary>
/// This summary does not work, I know it's for html documenting tools but thought it was worth a shot.
/// </summary>
and:
// Summary:
// This is what is in some of the base libraries, and does not work as well.
So, how do I add a summary to the mouse-over pop-up??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我不明白为什么你的第一次尝试不起作用。这是
评论标签,它提供了您正在谈论的“工具提示”...
如果您需要自动化某些评论的帮助,请尝试免费的 GhostDoc。迄今为止最好的免费 VS 插件之一..
I don't see why your first attempt wouldn't work. It's the
<summary>
comment tag which supplies the 'tooltip' you're talking about...If you want help automating some of your commenting, try the free GhostDoc. By far one of the best free VS addons..
我刚刚发现的两个附加检查将阻止悬停时显示摘要:
不要在您的代码中使用与号 (
&
) 或起始尖括号 (<
)摘要描述。中断:
改为使用:
中断:
这会起作用,但可能不是一个好的先例:
不要将
///
行彼此分开。休息:
休息:
工作:
Two additions to check for that I just discovered will prevent the summary from showing when hovering:
Do not use ampersands (
&
) or starting angle brackets (<
) in your summary description.Breaks:
Instead use:
Breaks:
This will work, but probably not a good precedent to set:
Do not separate the
///
lines from each other.Breaks:
Breaks:
Works:
三斜杠 XML 注释可用于在 Visual Studio 中创建 IDE 工具提示。尤其是“总结”和“例外”效果非常好。 (“代码”等其他内容在我使用的 Visual Studio 版本中不起作用。)
如果这对您不起作用,则您的设置可能有问题。
The three-slash XML comments may be used to create the IDE tool-tips in Visual Studio. In particular, "summary" and "exception" work very well. (Other things like "code" have not worked in the versions of Visual Studio that I have used.)
If this is not working for you, then something may be wrong with your settings.
重置 Visual Studio 中的设置,它们似乎混乱了。为了让它显示出来,您必须使用第一个示例。
Reset your settings in visual studio, they seem to be messed up. And for it to show up, you'd have to use the first example.
您需要使用第一个语法,并且,如果您在 Visual Studio 解决方案之外使用该类,则需要在项目属性中选中“生成 XML 文档文件”。
You need to use your first syntax, and, if you're using the class outside of your Visual Studio solution, you need to check Generate XML Documentation file in Project Properties.
除了上述答案之外,请访问 Microsoft 文档链接,获取完整的标签列表,为您的课程制作非常漂亮的摘要。
In addition to the above answers, visit the Microsoft docs link to get a complete list of tags to make a very beautiful summary for your classes.