Optimizing Code Snippets

Code Snippets are a great productivity boost that was introduced in Visual Studio 2005, if I remember right. Code Snippets lets you type a shortcut for a piece of code. I use snippets for properties a lot. I hate writing properties “by hand” – it is much faster with Code Snippets. But since Visual Studio 2008, the default prop shortcut now uses Dynamic Properties – but I still work on some projects that does not support Dynamic Properties. So I changed my default Code Snippets, and added a few other.

First I changed the default prop snippet back to the old property with a backing field. Then I added snippets for a Dynamic Property, Business Object Property (to use with Rockford Lhotka’s CSLA architecture) and a ViewState Property. See the code they all produce here:

[image This boosts productivity even more, and it is a great way to get rid of those lame things you do over and over again…

Download the snippets yourself bellow. Add them to your C:\Program Files\Microsoft Visual Studio 9.0\VC#\Snippets\1033\Visual C# directory, and replace the prop.snippet file when it prompts you.

Technorati Tags: [Visual Studio 2008](http://technorati.com/tags/Visual%20Studio%202008)
[CodeSnippets.zip (2.29 kb)](/file.axd?file=CodeSnippets.zip)