/// <inheritdoc /> public void ExceptWith(IEnumerable <IDisposable> other) { ISetContracts.ExceptWith(this, other); if (this.IsDisposed) { return; } this.disposables.ExceptWith(other); }
/// <summary> /// Provides an implementation of <see cref="ISet{T}.ExceptWith"/>. /// </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/dd382043(v=vs.110).aspx"/>; /// Removes all elements in the specified collection from the current set. /// </remarks> public static void ExceptWith <T>(ISet <T> source, IEnumerable <T> other) { Contracts.Requires.That(source != null); ISetContracts.ExceptWith(source, other); if (source.IsReadOnly) { return; } foreach (T value in other) { source.Remove(value); } }