c# - 如何添加鼠标悬停摘要

标签 c# visual-studio mouseover summary

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

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/

相关文章:

c# - 无法将方法组 '' 转换为非委托(delegate)类型 'System.Delegate'。您是否打算调用该方法?

c# - 如何修改 web.config 部分运行时?

c++ - 为什么 const_cast<iterator>(const_iterator) 在 Visual C++ 6.0 中有效,但在 Visual Studio .NET 中无效?

html - 鼠标悬停不能实时工作,在预览中工作

javascript - 删除监听器类不会停止与 Jquery Javascript 关联的声音事件

c# - Array.Sort() 对原始数组进行排序,而不仅仅是复制

visual-studio - 在 SandcaSTLe 生成的示例代码中添加行

c# - 如何从 Azure 服务器更新 Visual Studio 项目文件

javascript - 某些 javascript 函数无法在 iOS 设备(iPhone、iPad)上运行

c# - 以编程方式创建应用程序和服务