Visual Studio 2005 Tips #3: Using Surround with …

Another nice feature that will save on time and re-indenting your code is the Surrounds with snippets.  It works the same way as Code Snippets but the difference is that you highlight a section of code that you want to surround your code with.

This example I am going to surround a section of my code with a try catch.  The keyboard short cut is Ctrl + K and the S.

A popup combo box will appear asking you what type.  You can selec the you want to surround with.  Since I am going to use a try catch, I can hit the “T” key and then hit enter.

My code is now surrounded by a try/catch with the Exception object available for me to assign a variable to.

3 comments ↓

#1 dotnetkicks.com on 03.26.06 at 3:04 am

HOW TO: Using Surrounds with in Visual Studio 2005…

Trackback from dotnetkicks.com…

#2 deviceZero » Quick Visual Studio 2005 Tips on 03.27.06 at 7:58 pm

[...] To column select in VS2005/2003, press “ALT” and hold the left mouse button, then drag. Sweet! You can find more tips here. [...]

#3 Hulkster on 03.28.06 at 7:51 pm

Visual Studio 2005 Tips #3: Using Surround with … Timesaver!…

Visual Studio 2005 Tips #3: Using Surround with … - Another real nice feature that will save on……

Leave a Comment