CodeRush Template for INotifyPropertyChanged

Updated 6/6/14: @MarkMiller found my tweet the referred to this blog post and kindly pointed out that I had reinvented the wheel. If your class implements INotifyPropertyChanged, you could use the standard “p(type)” expansion and it’ll put in the property change code for you. You can customize the setter to use your framework by editing the System / Declaration Bodies / #PropertySetter# template. Big kudos to Mark for noticing my tweet and helping me with this!

See this to see what it looks like in action.

Raising a PropertyChanged event for every property in a class is a lot of typing, and if you have CodeRush for Visual Studio the following template should help you out.

(You’ll have to edit the “this.NotifyPropertyChanged” line to fit the way you raise this event in your framework.)

Seems like I need this once every year or so, and have to reinvent it every time. Hopefully this will be a good spot for me to pull this from.

This entry was posted in CodeRush, Programming. Bookmark the permalink.