VS 2008 - I want my prop snippet back!

For those of us that implement INotifyPropertyChanged on our state objects, the new Automatic Properties feature of Visual Studio 2008 hasn't been very useful.  In fact, the snippet prop that used to create a private variable and associated public property has now been replaced by an Automatic Property.

Thanks to a comment by SnYnE on this blog post, there is an easy way to get the functionality back.

Simply create a new text file at:
C:\users\*your user name*\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets

Call it "propc.snippet"

Populate the contents with:

prop propc Code snippet for property and backing field Microsoft Corporation Expansion type Property type int property Property name MyProperty field The variable backing this property myVar Now when you type "propc" in Visual Studio, you will get the property constructor that you are used to.
This article is part of the GWB Archives. Original Author: Tim Hibbard

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.