开发者

How to automatically generate comments in Visual Studio 2010 and C#?

From Eclipse I'm used that when I start typing a comment for a 开发者_高级运维class or method, the parameters, return types and exceptions are autogenerated. But in VisualStudio 2010 I can't find something like this. Any hints how to achieve that?


The only way I know to do this is on the line right above your method just type "///" and it will generate a comment template based on the method.


GhostDoc is a free extension that will do this. Just hit (by default) Ctrl+D anywhere within a method, and it will add XML Documentation comments with defaults filled in (though they typically should be modified/expanded).


Use "///" instead of "//" for comments. For example, the following comment was auto-generated by just starting to type "///":

/// <summary>
/// </summary>
/// <param name="terms"></param>
public TVec(IEnumerable<Term> terms)
{
}


Try typing "///" one line ahead of a method. Tell me if that is what you are looking for.


You can use Ghostddoc to generate alot of your xml comments: http://submain.com/products/ghostdoc.aspx

I think there is a free version available.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜