Skip to content

Add AObservableObject.OnPropertyChanged() overrides

Currently AObservableObject.OnPropertyChanged(ref T target, T value) checks for inequality before setting the value and raising the event. In hindsight, that was not the best choice for the default behavior. The method should set the target to the value and raise the event without any comparisons.

To address this poor design, I suggest the following:

  1. Deprecate the two OnPropertyChanged() methods.
  2. Implement RaisePropertyChanged() methods using the new desired default behavior.
  3. Implement RaiseIfPropertyChanged() method that takes an EqualityComparer<T>.
  4. Implement RaiseIfPropertyChanged() override to wrap the previous default behavior.