有谁知道我可以插入当前日期和方式的方式;在visual studio 2008片段中的时间?我想要的是在.snippet文件的主体中这样的东西......
<Code Language="csharp">
<![CDATA[
// $DateTime$
// more code here for my snippet...
</Code>
答案 0 :(得分:18)
没有可用于片段的DateTime函数,但这里是一个将插入当前DateTime的宏:
Sub PrintDateTime()
If (Not IsNothing(DTE.ActiveDocument)) Then
Dim selection As TextSelection = DTE.ActiveDocument.Selection
selection.Insert(DateTime.Now.ToString())
End If
End Sub
您可以使用 Alt + F8 打开宏浏览器并创建一个新模块并将上面的代码粘贴到生成的模块中。
然后创建一个新的键盘快捷键并将其绑定到您的宏。