There is a propfull code snippet for property and backing field

By | August 20, 2013

Code snippets have been around for a long time and is one of the easiest ways for the developer productivity.  We do use many of them frequently as they are very commonly in used, however there are a few which are really useful but many of us does not know about them.

For an instance,  a very useful time saver  code snippet is  “prop”  which is use for “Automatically implemented property” . In this case, if we type prop and then press TAB key twice, an automatic property will be added with default type of int . ( Refer the image below)

prop_codesnippet_automatic_property

What if, if you want a property with declarative backing field ( Generally we defined them using a private variable and public exposed property  with same type)?  In this case rather typing the complete stuff, you can use propfull which gives you a private backing variable and then a public GET and SET with the link of just declared private variable.  

propfull_codesnippet

  You can change the type and variables name by just moving around the code block  using Tab Key press.

propfull_codesnippet_change_in_variablename

This will save a good amount of time compared to manual process.