/// <summary> /// Fires the <see cref="IObserver{T}.OnCompleted"/> method and removes the observation from the observation list. /// The observer will not receive any further notifications. /// </summary> /// <param name="observation">The observation to remove.</param> /// <remarks> /// This method is called internally by the various observation classes when the <see cref="IDisposable.Dispose"/> method is called on them. /// </remarks> internal virtual void RemoveFundingObservation(FundingObservation observation) { observation.Observer.OnCompleted(); lock (observations) { if (observations2.Contains(observation)) { observations2.Remove(observation); } } }
/// <summary> /// Subscribe to this feed. /// </summary> /// <param name="observer">A class object that implements the <see cref="IObserver{T}"/> interface.</param> /// <returns>An <see cref="IDisposable"/> implementation that can be used to cancel the subscription.</returns> IDisposable IObservable <FundingSettlement> .Subscribe(IObserver <FundingSettlement> observer) { lock (observations2) { foreach (var obs in observations2) { if (obs.Observer == observer) { return(obs); } } var obsNew = new FundingObservation(this, observer); observations2.Add(obsNew); return(obsNew); } }