SortedSet<T>.ExceptWith(IEnumerable<T>) メソッド

定義

現在の SortedSet<T> オブジェクトから、指定したコレクション内のすべての要素を削除します。

public:
 virtual void ExceptWith(System::Collections::Generic::IEnumerable<T> ^ other);
public void ExceptWith(System.Collections.Generic.IEnumerable<T> other);
abstract member ExceptWith : seq<'T> -> unit
override this.ExceptWith : seq<'T> -> unit
Public Sub ExceptWith (other As IEnumerable(Of T))

パラメーター

other
IEnumerable<T>

SortedSet<T> オブジェクトから削除する項目のコレクション。

実装

例外

othernullです。

次の例では、別の並べ替えられたセットで重複している並べ替えられたセットから要素を削除します。 このコード例は、 SortedSet<T> クラスに提供されるより大きな例の一部です。

// Remove elements in mediaFiles1 that are also in mediaFiles2.
Console.WriteLine("Remove duplicates (of mediaFiles2) from the set...");
Console.WriteLine($"\tCount before: {mediaFiles1.Count}");
mediaFiles1.ExceptWith(mediaFiles2);
Console.WriteLine($"\tCount after: {mediaFiles1.Count}");
' Remove elements in mediaFiles1 that are also in mediaFiles2.
Console.WriteLine("Remove duplicates (of mediaFiles2) from the set...")
Console.WriteLine($"{vbTab}Count before: {mediaFiles1.Count}")
mediaFiles1.ExceptWith(mediaFiles2)
Console.WriteLine($"{vbTab}Count after: {mediaFiles1.Count}")

注釈

このメソッドは、現在の SortedSet<T> 内にある、 other内にある要素を削除します。 other内の重複する値は無視されます。

このメソッドは O(n log m) 操作であり、 mCount され、 nother内の要素の数です。

適用対象