private void ProcessCollectionChanged(NotifyCollectionChangedEventArgs args) { if (this.CheckFlag(CollectionViewFlags.ShouldProcessCollectionChanged)) { if (args.get_Action() == 4) { if (!this.SourceCollection.GetEnumerator().MoveNext()) { this._internalList.Clear(); } this.RefreshOrDefer(); } else { object item = (args.get_NewItems() != null) ? args.get_NewItems()[0] : null; object removedItem = (args.get_OldItems() != null) ? args.get_OldItems()[0] : null; if ((args.get_Action() == 1) || (args.get_Action() == 2)) { this.ProcessRemoveEvent(removedItem, args.get_Action() == 2); } if (((args.get_Action() == null) || (args.get_Action() == 2)) && ((this.Filter == null) || this.PassesFilter(item))) { this.ProcessAddEvent(item, args.get_NewStartingIndex()); } if (args.get_Action() != 2) { this.OnPropertyChanged("ItemCount"); } } } }