Optimizing INotifyPropertyChanged for performance vs convenience

One of the central aspects of implementing the MVVM pattern is the ubiquitous invocations of INotifyPropertyChanged.PropertyChanged in property setters. The simplest version that is commonly seen just passes the property name as a string and builds an EventArgs object in the shared NotifyPropertyChanged method. public int MyProperty { get { return _myProperty; } set { if (_myProperty == value) return; _myProperty = value; NotifyPropertyChanged("MyProperty"); } } Over time, the verbosity of the basic pattern boilerplate has been reduced in various ways, usually with one of two goals: shorter code or stronger links between the event args and the name of the property itself....

November 17, 2014 · 4 min · 652 words · John Bowen