Visual Studio provides a bunch of good code snippets for creating boilerplate code. For example if you type “prop” you get this in intellisense
You’ll see a few nice property snippets.
- prop – creates a basic automatic property
- propa – creates an attached property
- propdp – creates a dependency property
- propfull – creates a public property with a private backing field
- propg – creates a basic automatic property but the set is marked private
I use these constantly but hit an issue when building my Windows 8 apps. For ViewModels in Windows 8, the default templates take advantage of a wonderful attribute CallerMemberName in the OnPropertyChanged method of the ViewModel base class. This allows you to create properties that support notifications in a very simple manner. Like this
Funny... I was just looking for something like this. I love the inter-tubes.