如何添加鼠标悬停摘要

Ste*_* H. 7 c# summary mouseover visual-studio

我几乎可以肯定这将是一个非常简单的答案,但我似乎无法在任何地方找到它.我们都知道当你将鼠标悬停在某些东西(如字符串)上时会弹出一个小摘要(如果已启用).对于一个字符串,它说:

class System.String

将文本表示为一系列Unicode字符.

当我鼠标的一个我的类,它只是说:

classNamespace.Widget

我已经尝试了我发现的两个明显的例子:

/// <summary>
/// This summary does not work, I know it's for html documenting tools but thought it was worth a shot.
/// </summary>
Run Code Online (Sandbox Code Playgroud)

和:

// Summary:
//     This is what is in some of the base libraries, and does not work as well.
Run Code Online (Sandbox Code Playgroud)

那么,如何在鼠标悬停弹出窗口中添加摘要?

KP.*_*KP. 7

我不明白为什么你的第一次尝试不起作用.它是<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();
    }
}
Run Code Online (Sandbox Code Playgroud)

如果您想要帮助自动化一些评论,请尝试免费的GhostDoc.到目前为止最好的免费VS插件之一..