如何在C#中的类,方法,属性等中添加文档工具提示? [英] How to add documentation tooltip to classes, methods, properties, etc. in C#?

查看:134
本文介绍了如何在C#中的类,方法,属性等中添加文档工具提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定我是否称其为正确方法,但我想开始向我的类,方法,属性等添加一些文档.我知道这可能非常明显,但我从未真正学过它.我不确定从哪里开始.

Not sure if I'm even calling this right but I wanted to start adding some documentation to my classes, methods, properties, etc. I know this is probably super obvious but I never really learned it. I'm not sure where to start.

只要澄清一下,当您将鼠标悬停在类(或方法,属性等)上时,它就会在Visual Studio中显示工具提示,并提供有关该特定方法的一些文档.

Just to clarify whenever you roll over a class (or method, property, etc.) it shows a tooltip in Visual Studio with some documentation on that specific method.

Microsoft.Phone.BackgroundAudio.BackgroundAudioPlayer类
提供对音频播放功能的后台访问,例如播放,暂停,快进和快退.

class Microsoft.Phone.BackgroundAudio.BackgroundAudioPlayer
Provides background access to audio playback functionality such as play, pause, fast-forward, and rewind.

这叫什么,如何在C#应用程序中实现呢?

What is that called and how can I implement this in my C# application?

推荐答案

您可以使用///或 GhostDoc

在第一种情况下,您会得到

In first case you'll get

/// <summary>
/// 
/// </summary>
class A
{
    /// <summary>
    /// 
    /// </summary>
    public A() { }

    /// <summary>
    /// 
    /// </summary>
    public int Property { get; set; }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="obj"></param>
    public void Method(object obj) { }
}

第二秒

/// <summary>
/// 
/// </summary>
class B
{

    /// <summary>
    /// Initializes a new instance of the <see cref="B"/> class.
    /// </summary>
    public B() { }

    /// <summary>
    /// Gets or sets the property.
    /// </summary>
    /// <value>
    /// The property.
    /// </value>
    public int Property { get; set; }

    /// <summary>
    /// Methods the specified obj.
    /// </summary>
    /// <param name="obj">The obj.</param>
    public void Method(object obj) { }
}

这篇关于如何在C#中的类,方法,属性等中添加文档工具提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆