Friday, September 26, 2008

Insert code block in Visual Studio 2005

It's a bit embarrassing to say that I have not understood how this worked until now...

In ReSharper you have had the possibility to write a keyword, for example "foreach" and then the tool fills in the rest.

This function exists in VS 2005 also, but since it's not that intuitive (you get a tooltip saying "foreach code snippet", but not how to) I have not used it. Today I tested using Tab and nothing happened, until I didi it again. Then it worked just like ReSharper.

1) Starting to write:














2) First Tab

3) Second Tab

Then you Tab between the colored areas and fill them with your values. Finish by pressing Enter, then you end up between the braces.