如何编写注释/文档在VS 2010中的变量/场/列表? [英] How to write comments / documentation for variables / fields / lists in VS 2010?

查看:144
本文介绍了如何编写注释/文档在VS 2010中的变量/场/列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  ///<总结>
///这是总结了一些类或方法
///< /总结>
 

有关类或方法的文档。但如何写这个简单的变量或列表?

我使用Visual Studio 2010,当我悬停在一些名单,财产或什么都我想看到某种摘要(中那个小提示),我已经写了具体的东西。

  ///< D​​OC>
///始终使用该列表!
名单<字符串>啤酒=新的名单,其中,字符串>();
 

编辑:好的,我们已经发现了,它的工作原理像往常一样在你的类,但外面的方法或函数!!长ü评论

任何方式中的一个方法太文档/评论?

 公共类BeerForall
{
    ///<总结>
    ///它在这里工作
    ///< /总结>
    公开名单<字符串>啤酒=新的名单,其中,串>();

    公共字符串giveBeer()
    {
        ///不工作,你无法发表评论
        ///<总结>
        ///试验测试,不工作
        ///< /总结>
        名单<字符串> moreBeer =新的名单,其中,串>();

        返回啤酒;
    }
}
 

解决方案

似乎工作在Visual Studio 2010中我定义了一个列表,与在我MainForm类评论的私人领域完全正常的。

他们不会为局部变量的虽然在功能定义的工作。

There is

///<summary>
///This is summary for some class or method
///</summary>

documentation for classes or methods. But how to write this for simple variables or lists?

I use Visual Studio 2010 and when i hover over some list, property or what ever i would like to see some kind of summary (in that little tooltip) i have written to that specific thing.

///<doc>
///always use this list!
List<String> beer = new List<String>();

edit: ok, we have found out, that it works as usual as long u comment in your class but OUTSIDE a method or a function!!

Any way to document/comment within a method too?

public class BeerForall
{
    /// <summary>
    /// it works here
    /// </summary>
    public List<String> beer = new List<string>();

    public String giveBeer()
    {
        /// is not working, u can not comment
        /// <summary>
        /// test test, not working
        /// </summary>
        List<String> moreBeer = new List<string>();

        return "beer";
    }
}

解决方案

Seems to work perfectly fine in Visual Studio 2010. I defined a List as a private field with a comment inside my MainForm class.

They won't work for local variables defined within functions though.

这篇关于如何编写注释/文档在VS 2010中的变量/场/列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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