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 ↓
HOW TO: Using Surrounds with in Visual Studio 2005…
Trackback from dotnetkicks.com…
[...] To column select in VS2005/2003, press “ALT” and hold the left mouse button, then drag. Sweet! You can find more tips here. [...]
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