Skip to content

Tip 2.39: You can insert a code snippet via its shortcut keyword

May 30, 2013

“Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio“, courtesy of ‘Sara Ford’

Sara Ford’s Blog

Code snippets have the support to be given a “shortcut,” usually an abbreviated version of the code snippet name that you can type into the editor and hit Tab to insert.

To insert, simply type in the name of the snippet—for example, for—and then hit Tab. Note that if statement completion is open, you’ll have to hit Tab twice to insert the snippet.

In Visual Studio 2005, 2008 and 2012, you’ll be able to see C# Code Snippet shortcuts in the statement completion window. The following screen shot is the for snippet displayed within the statement completion window. Note the snippet icon to the left.

In both Visual Studio 2008 and 2012, you won’t see Visual Basic snippets in the statement completion window, but you will see a note in the ToolTip when you can hit Tab twice to insert the corresponding snippet.

Happy Programming! =)

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: