简体   繁体   中英

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

        /// <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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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