public void Dispose() { lock (gate) { if (parent != null) { lock (parent.observerLock) { var listObserver = parent.outObserver as ListObserver <T>; if (listObserver != null) { parent.outObserver = listObserver.Remove(unsubscribeTarget); } else { parent.outObserver = EmptyObserver <T> .Instance; } unsubscribeTarget = null; parent = null; } } } }
public Subscription(DynamicSubject <T> parent, IObserver <T> unsubscribeTarget) { this.parent = parent; this.unsubscribeTarget = unsubscribeTarget; }