Thanks to everyone who came along to my DEV311 at TechEd New Zealand yesterday. Here’s the low down on the snippets demo that didn’t work the way it should on the day …
Notifying Properties
Creating a property that triggers the PropertyChanged
event isn’t difficult, but it is mindless boilerplate. The
propn
snippet makes it really easy to write with just a few keystrokes.
Here’s the output of using the snippet to declare a FullName
property:
Note that this is triggering the OnPropertyChanged()
method with no parameters, expecting it to use the new
[CallerMemberName]
attribute introduced in .NET 4.5.
INotifyPropertyChanged Implementation
The supporting infrastructure for the INotifyPropertyChanged
event is also boilerplate - hence the notify
snippet
that produces this code:
Between notify
and propn
, writing the infrastructure to support databinding is a whole lot easier.
Comments
blog comments powered by Disqus