public static void NotifyPropertyChanged <T>(this PropertyChangedEventHandler handler, object obj, Expression <Func <object> > property, ref T variable, T newValue) { if ((variable != null && !variable.Equals(newValue)) || (newValue != null && !newValue.Equals(variable))) { variable = newValue; handler.NotifyPropertyChanged(obj, property); } }