Ger*_*ero 18 .net c# visual-studio-2010 xml-documentation visual-studio
有
///<summary>
///This is summary for some class or method
///</summary>
Run Code Online (Sandbox Code Playgroud)
类或方法的文档.但是如何为简单的变量或列表编写这个?
我使用Visual Studio 2010,当我将鼠标悬停在某个列表,属性或者我希望看到的某种摘要(在那个小工具提示中)时,我已经写了那个特定的东西.
///<doc>
///always use this list!
List<String> beer = new List<String>();
Run Code Online (Sandbox Code Playgroud)
编辑:好的,我们已经发现,它像往常一样在你的班级中发表评论,但是OUTSIDE方法或功能!!
有什么办法在方法中记录/评论吗?
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";
}
}
Run Code Online (Sandbox Code Playgroud)
gid*_*eon 12
似乎在Visual Studio 2010中工作得非常好.我将List定义为私有字段,在我的MainForm类中有注释.
但它们不适用于函数中定义的局部变量.
Cra*_*ntz 12
正如其他人提到的,你无法获得本地变量的IntelliSense.但是:如果你的函数太大,以至于"常规"注释不足以在你使用var的地方附近阅读,那么正确的修复是重构函数 - 将其分解为多个较小的方法,vars较少.我不认为这个功能应该存在,因为它只会有助于编写过大的功能.
归档时间: |
|
查看次数: |
27954 次 |
最近记录: |