Duane Newman

.NET, Windows, Linux, gadgets, and other cool stuff

  • Blogroll

  • Flickr

    John Oliver CabinHand Blown Glass OrnamentsCades CodeIslands in the Clouds
  • My Del.icio.us

Where, O Where, did my old prop snippet go

Posted by duane on March 10th, 2008

Wes has a nice blog post about customizing the prop code snippet from VS2005 to use “_PropertyName” for the private field. While I like to use propertyName for my private fields this did get me to thinking and spurred me on to action over something that has annoyed me since I started using VS2008.

In VS2008 the prop snippet changes, it makes use of the automatic properties and will thus not create the private field and setter/getter to that field. In general that is not a problem-but it can be annoying that there is no snippet provided for those times when you need to make properties with custom getter or setter validation and would like the “cookie cutter” part “cookie cut” for you.

I’ve created the propf (property w/private field backer) snippet. This snippet basically gives you back the VS2005 prop snippet functionality when you need it. Just place it in your “%userprofile%\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets\” directory, go in studio and type propf, hit tab, and enjoy.

download propf snippet

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>