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:
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.
Subscribe to Martin Normark's Blog
Get the latest posts delivered right to your inbox