There is a propfull code snippet for property and backing field

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. 

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.