private void UnsubscribeFromItem(T item)
        {
            bool wasLastInstanceOfItemRemovedFromCollection = this.ReferenceCountTracker.Remove(item);

            if (!wasLastInstanceOfItemRemovedFromCollection || !this.IsMonitoringChildProperties)
            {
                return;
            }

            if (_propertyChangedSubscription != null)
            {
                _propertyChangedSubscription.UnsubscribeFromChanges((INotifyPropertyChanged)item, this);
            }
            else
            {
                this.Subscriptions[item].PropertyChanged -= OnAnyPropertyChangeInSubscriptionTree;
                this.Subscriptions.Remove(item);
            }
        }
示例#2
0
        internal void UnsubscribeFromChanges(T subject)
        {
            if (EntireTreeSupportINotifyPropertyChanging)
            {
                if (_PropertyAccessTree == null)
                {
                    return;
                }
                _PropertyAccessTree.UnsubscribeFromChanges(subject, this);
            }
            else
            {
                if (_Subscriptions == null)
                {
                    return;
                }

                _Subscriptions[subject].PropertyChanged -= OnAnyPropertyChangeInSubscriptionTree;
                _Subscriptions.Remove(subject);
            }
        }