public void Dispose()
            {
                object obj = this.gate;

                lock (obj)
                {
                    if (this.parent != null)
                    {
                        object observerLock = this.parent.observerLock;
                        lock (observerLock)
                        {
                            ListObserver <T> listObserver = this.parent.outObserver as ListObserver <T>;
                            if (listObserver != null)
                            {
                                this.parent.outObserver = listObserver.Remove(this.unsubscribeTarget);
                            }
                            else
                            {
                                this.parent.outObserver = new EmptyObserver <T>();
                            }
                            this.unsubscribeTarget = null;
                            this.parent            = null;
                        }
                    }
                }
            }
示例#2
0
 public void Dispose()
 {
     lock (gate)
     {
         if (parent != null)
         {
             lock (parent.observerLock)
             {
                 ListObserver <T> listObserver = parent.outObserver as ListObserver <T>;
                 if (listObserver != null)
                 {
                     parent.outObserver = listObserver.Remove(unsubscribeTarget);
                 }
                 else
                 {
                     parent.outObserver = EmptyObserver <T> .Instance;
                 }
                 unsubscribeTarget = null;
                 parent            = null;
             }
         }
     }
 }