/// <summary>
 /// Updates the snapshot that is used to generate an Enumerator
 /// </summary>
 /// <param name="forceUpdate"></param>
 private void UpdateSnapshot()
 {
     if (_newSnapshotRequired)
     {
         _snapshotLock.TryEnterWriteLock(Timeout.Infinite);
         if (_newSnapshotRequired)
         {
             _baseSnapshot        = new ImmutableCollection <T>(_baseCollection);
             _newSnapshotRequired = false;
         }
         _snapshotLock.ExitWriteLock();
     }
 }
        private void OnCreated(IEnumerable <T> enumerable)
        {
            _subscribers = new Dictionary <int, IObserver <NotifyCollectionChangedEventArgs> >();

            _baseSnapshot = new ImmutableCollection <T>(enumerable);

            // subscribers must be initialized befor calling this as it may
            // subscribe immediately
            _viewModel = new ObservableCollectionViewModel <T>(this);

            // Handle when the base collection changes. Event will be passed through
            // the IObservable.OnNext method.
            _baseCollection.CollectionChanged += HandleBaseCollectionChanged;

            // Bubble up the notify collection changed event from the view model
            _viewModel.CollectionChanged += (sender, e) => CollectionChanged?.Invoke(sender, e);
        }