I use the following bit of code in cookie cutter mode, across dozens of classes
public event PropertyChangedEventHandler PropertyChanged; protected void NotifyPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } }
All of these classes implement INotifyPropertyChanged . To disable my DRY alarms, lately I have refactored these classes to inherit my base class PropertyNotifier , whose sole purpose is to provide NotifyPropertyChanged for the classes inherited from it - there are dozens of ViewModel classes in my huge project.
He feels lazy and a little dirty. Can I harm work or disrupt good design practices? I believe that if the change notification should have been so simple, there would have been a base class already in the WPF environment, which does what my PropertyNotifier class does.
Please note that for many reasons I had performance issues with my user interface in mind - mainly due to the large number of controls. Therefore, I am looking to trim fat wherever I can. Any ideas?
bufferz
source share