/// <summary> /// Subscribe to this feed for only the specified tickers. /// </summary> /// <param name="symbols">The list of symbols that the observer will observe.</param> /// <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> public IDisposable Subscribe(IObserver <Ticker> observer, IEnumerable <string> symbols) { lock (observations) { foreach (var obs in observations) { if (obs.Observer == observer) { return(obs); } } var obsNew = new SymbolObservation <Ticker>(symbols, this, observer); observations.Add(obsNew); return(obsNew); } }
/// <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> public override IDisposable Subscribe(IObserver <Ticker> observer) { lock (observations) { foreach (var obs in observations) { if (obs.Observer == observer) { return(obs); } } var obsNew = new SymbolObservation <Ticker>(this, observer); observations.Add(obsNew); return(obsNew); } }