简体   繁体   English

是否有任何快捷方式将当前DateTime标记片段添加到Visual Studio中的c#文件

[英]Is there any shortcut to add current DateTime stamp snippet to c# file in Visual studio

This may be foolish, but i am looking for shortcut like F5 in notepad to add date time stamp, for simple summary task in c# files, for eg 这可能是愚蠢的,但我在记事本中寻找像F5这样的快捷方式来添加日期时间戳,用于c#文件中的简单摘要任务,例如

        /// <summary>
        /// Created By: Developer Name
        /// Created On: 12:08 PM 10/28/2013
        /// Pass HTML SELECT control and IsFirstOptionToRemove (optional) to find all its values and displayed text
        /// </summary>
        /// <param name="selectControl"></param>
        /// <param name="IsFirstOptionToRemove"></param>
        /// <returns>retruns dictionary containing key value pairs of select control options. </returns>

i don't expect all these lines as snippet but can i have current date time stamp in my snippet. 我不希望所有这些行作为代码片段,但我可以在我的代码段中有当前日期时间戳。 I didn't find a way to modify custom snippet dynamically. 我没有找到一种动态修改自定义代码段的方法。

There's a macro-based solution described here: 这里描述了一个基于宏的解决方案:

http://www.dmcinfo.com/latest-thinking/blog/articletype/articleview/articleid/62/net-commenting-macro.aspx http://www.dmcinfo.com/latest-thinking/blog/articletype/articleview/articleid/62/net-commenting-macro.aspx

Basically, you make a macro like this: 基本上,你创建一个像这样的宏:

 Sub CommentInitialsDate()
     DTE.ActiveDocument.Selection.Text = "// [INSERT MY INITIALS HERE] " & Format(Date.Today, "yyyy-MM-dd") & " - "
 End Sub

And then you assign a shortcut key. 然后分配快捷键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM