コード例 #1
0
            public void Dispose()
            {
                // Use atomic exchange to ensure that Unsubscribe() is only called once,
                // even if Dispose() is called simultaneously.
                IObserver <T> observer = Interlocked.Exchange(ref _observer, null);

                if (observer != null)
                {
                    _subject.Unsubscribe(observer);
                    _subject = null;
                }
            }
コード例 #2
0
 public Subscription(WeakSubject <T> subject, IObserver <T> observer)
 {
     _subject  = subject;
     _observer = observer;
 }