public static void RaiseAndSetIfChanged <T>( this ReactiveObject reactiveObj, ref T item, T newItem, BitArray hasBeenSet, bool newHasBeenSet, int index, string name, string hasBeenSetName) { var oldHasBeenSet = hasBeenSet[index]; bool itemEqual = EqualityComparer <T> .Default.Equals(item, newItem); if (oldHasBeenSet != newHasBeenSet) { reactiveObj.RaisePropertyChanging(hasBeenSetName); hasBeenSet[index] = newHasBeenSet; } if (!itemEqual) { reactiveObj.RaisePropertyChanging(name); item = newItem; reactiveObj.RaisePropertyChanged(name); } if (oldHasBeenSet != newHasBeenSet) { reactiveObj.RaisePropertyChanged(hasBeenSetName); } }
public static void RaiseAndSetIfChanged( this ReactiveObject reactiveObj, BitArray hasBeenSet, bool newHasBeenSet, int index, string name) { var oldHasBeenSet = hasBeenSet[index]; if (oldHasBeenSet == newHasBeenSet) { return; } reactiveObj.RaisePropertyChanging(name); hasBeenSet[index] = newHasBeenSet; reactiveObj.RaisePropertyChanged(name); }