C# 5 PropertyChanged - No more magic strings!

added by dpeterson
9/22/2011 10:30:01 AM

954 Views

Changes in C# 5 mean no more NotifyPropertyChanged("SomeVariable"), which is a common source of bugs. It also means we no longer have to suffer the performance degradation associated with using workarounds such as lambda's just for the sake of compile-time checking. From here on out, the compiler does the work for us.


2 comments

vijayst
9/22/2011 10:39:05 AM
So far the automatic code snippet generation has improved the productivity while defining properties. This feature will definitely help making the code cleaner.

dpeterson
9/22/2011 10:52:47 AM
I use the lambda approach for compile-time checking: NotifyOfPropertyChange(() => SomeVariable)
It adds some line noise, and also reduces performance slightly. I'm looking forward to not having to do that.