public override void OnNext(IChange <CollectionOperation <T> > value) { if (value == null) { return; } Dictionary <T, TAdaptee> removedOnChange = null; foreach (var update in value.Operations()) { switch (update.Type) { case CollectionOperationType.Add: _state.OnAdd(update.Item, _func, removedOnChange); break; case CollectionOperationType.Remove: _state.OnRemove(update.Item, ref removedOnChange); break; case CollectionOperationType.Clear: _state.Clear(); break; default: throw new ArgumentOutOfRangeException(); } } var adapter = new Change(value, _state, removedOnChange); var result = new ChangedCollectionData <TAdaptee>(adapter, _state); this.Adaptee.OnNext(result); }
public override void OnNext(ChangedCollectionData <T> value) { var change = new CollectionChange <T, TAdaptee>(value.Change, _selector); var state = new CollectionAdapter <T, TAdaptee>(value.ReachedState, _selector); this.Adaptee.OnNext(new ChangedCollectionData <TAdaptee>(change, state)); }