/// <summary> /// <para> /// Clears the set of subscribed symbols. /// </para> /// <para> /// Implementation notes. /// </para> /// <para> /// This method notifies all subscribed <see cref="OnSymbolsRemoved"/> events on /// clear symbols from this subscription. /// </para> /// </summary> public void Clear() { if (IsClosed) { return; } lock (symbolsLocker) { OnSymbolsRemoved?.Invoke(this, new DXFeedSymbolsUpdateEventArgs(GetSymbols())); subscriptionInstance.Clear(); } }
/// <summary> /// <para> /// Removes the specified array of symbols from the set of subscribed symbols. /// This is a convenience method to remove one or few symbols at a time. /// When removing multiple symbols at once it is preferable to use /// <see cref="RemoveSymbols(ICollection{object})"/> method. /// </para> /// <para> /// Implementation notes. /// </para> /// <para> /// This method notifies all subscribed <see cref="OnSymbolsRemoved"/> events on /// symbols changing for this subscription. /// </para> /// </summary> /// <param name="symbols">The array of symbols.</param> public void RemoveSymbols(params object[] symbols) { if (IsClosed) { return; } if (symbols == null || symbols.Length == 0) { return; } lock (symbolsLocker) { subscriptionInstance.RemoveSymbols(SymbolsToStringList(symbols).ToArray()); OnSymbolsRemoved?.Invoke(this, new DXFeedSymbolsUpdateEventArgs(symbols)); } }
/// <summary> /// <para> /// Changes the set of subscribed symbols so that it contains just the symbols from /// the specified collection. /// To conveniently set subscription for just one or few symbols you can use /// <see cref="SetSymbols(object[])"/> method. /// All registered event listeners will receive update on the last events for all /// newly added symbols. /// </para> /// <para> /// Implementation notes. /// </para> /// <para> /// This method notifies all subscribed <see cref="OnSymbolsAdded"/> and /// <see cref="OnSymbolsRemoved"/> events on symbols changing for this subscription. /// </para> /// </summary> /// <param name="symbols">The collection of symbols.</param> public void SetSymbols(ICollection <object> symbols) { if (IsClosed) { return; } if (symbols == null || symbols.Count == 0) { return; } lock (symbolsLocker) { OnSymbolsRemoved?.Invoke(this, new DXFeedSymbolsUpdateEventArgs(GetSymbolsUnsafe())); subscriptionInstance.SetSymbols(SymbolsToStringList(symbols).ToArray()); OnSymbolsAdded?.Invoke(this, new DXFeedSymbolsUpdateEventArgs(symbols)); } }