我在哪里可以找到一个Visual Studio插件,该插件可以为方法和属性自动生成文档标题?自动添加.Net代码注释
实例的属性注释看起来是这样的:从http://www.roland-weigelt.de/ghostdoc/
我在哪里可以找到一个Visual Studio插件,该插件可以为方法和属性自动生成文档标题?自动添加.Net代码注释
实例的属性注释看起来是这样的:从http://www.roland-weigelt.de/ghostdoc/
Ghostdoc是通常的嫌疑。
作为另一个提到的海报,Visual Studio也通过在属性/方法/类定义之前的行上输入3'///'(正斜线)来做到这一点。
/// <summary>
/// Gets or sets the value of message
/// </summary>
public static string Message
{
get
{
return message;
}
set
{
message = value;
}
}
Visual Studio自动执行此操作。只要把光标定位直接方法上面进三'/的 例如:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MvcWidgets.Models
{
/// <summary>
/// This is a summary comment
/// </summary>
public class Comment
{
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <param name="birthdate"></param>
/// <param name="website"></param>
/// <returns></returns>
public int SomeMethod(string name, DateTime birthdate, Uri website)
{
return 0;
}
}
}
然后,您可以生成一个XML注释文件,然后使用沙塔生成一个帮助文件。
您可能必须在文本编辑器/ C#/高级选项对话框中启用此功能。
这个评论对任何人都有用吗? – 2009-01-03 20:18:44
是的,我宁愿没有评论比跛脚。如果该方法没有评论,至少你知道你可能想回去添加一个。 – 2009-01-04 06:10:54
我的感悟。我的一位同事被迫使用StyleCop,即使在事件的方法头文档中,该死的东西也会发现任何错误,所以她需要一些自动化。 – Germstorm 2009-01-04 10:33:07