SortedSet<T>.ExceptWith(IEnumerable<T>) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
現在の 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> オブジェクトから削除する項目のコレクション。
実装
例外
other
が null
です。
例
次の例では、別の並べ替えられたセットで重複している並べ替えられたセットから要素を削除します。 このコード例は、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}")
注釈
このメソッドは、other
現在SortedSet<T>の要素も削除します。 重複する値は other
無視されます。
このメソッドはO(n)
、パラメーター内other
の要素の数を示す操作n
です。