/// <inheritdoc /> public void UnionWith(IEnumerable <IDisposable> other) { ISetContracts.UnionWith(this, other); if (this.IsDisposed) { return; } this.disposables.UnionWith(other); }
/// <summary> /// Provides an implementation of <see cref="ISet{T}.UnionWith"/>. /// </summary> /// <typeparam name="T">The type of values in the collections.</typeparam> /// <param name="source">The source collection that is implementing <see cref="ISet{T}"/>.</param> /// <param name="other">The other enumerable.</param> /// <remarks> /// From <see href="https://msdn.microsoft.com/en-us/library/dd411713(v=vs.110).aspx"/>; /// Modifies the current set so that it contains all elements that are present in the current set, /// in the specified collection, or in both. /// </remarks> public static void UnionWith <T>(ISet <T> source, IEnumerable <T> other) { Contracts.Requires.That(source != null); ISetContracts.UnionWith(source, other); if (source.IsReadOnly) { return; } foreach (T value in other) { source.Add(value); } }