1.添加 Macros for Visual Studio 扩展
2. 添加 Macro 脚本
Method Note 中的 代码如下(一键下载文章中使用的Macro文件):
var date = new Date();
var year = date.getYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hours = date.getHours();
var minutes = date.getMinutes();
month = month < 10 ? ("0" + month) : ("" + month);
day = day < 10 ? ("0" + day) : ("" + day);
hours = hours < 10 ? ("0" + hours) : ("" + hours);
minutes = minutes < 10 ? ("0" + minutes) : ("" + minutes);
var doc = dte.ActiveDocument;
doc.Selection.Text = "///";
doc.Selection.LineDown();
doc.Selection.EndOfLine();
doc.Selection.NewLine();
doc.Selection.Text = "<remark>";
doc.Selection.NewLine();
doc.Selection.LineUp();
doc.Selection.EndOfLine();
doc.Selection.NewLine();
doc.Selection.Text = "<para/>Author : AnDequan";
doc.Selection.NewLine();
doc.Selection.Text = "<para/>Date : " + year + "-" + month + "-" + day + " " + hours + ":" + minutes;
3.添加 快捷键 ,本人用的 Ctrl M,1
4.效果演示:
在 Class 或者 函数 上 使用快捷键 Ctrl M,1 即可
同理做了一个单行注释如下图:
l