Visual Studio Tip – Code Snippets

This is an easy time saving tip for the IDE that I’m surprised more developers aren’t aware of.  Basically it saves us writing a whole stack of repetitive code.

"Expansion" snippets can be accessed by pressing tab tab in quick succession after typing a word.  For example type for then tab tab to get the following snippet.

 

"SurroundWith" snippets can be access by highlighting the code you want to surround then pressing ctrl+k then crtl+s in fast succession.  For example if we highlight the above for loop we generated with the expansion snippet then select the try "SurroundsWith" snippet we’ll get the following.

Advertisements
This entry was posted in .NET. Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s