public SafeObservingCollection(SafeObservedCollection <T> otherCollection) { otherCollection.Lock(); viewedCollection = otherCollection; otherCollection.OnCollectionChanged += new NotifyCollectionChangedEventHandler(collection_OnCollectionChanged); foreach (var item in otherCollection) { collection.Add(item); } otherCollection.Unlock(); SafeObservingCollectionManager.Register(this); }
public void Dispose() { viewedCollection.OnCollectionChanged -= new NotifyCollectionChangedEventHandler(collection_OnCollectionChanged); SafeObservingCollectionManager.Unregister(this); Clear(); }