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> 개체에서 제거할 항목 컬렉션입니다.

구현

예외

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}")

설명

이 메서드는 에 있는 현재 SortedSet<T> 요소도 other제거합니다. 의 other 중복 값은 무시됩니다.

이 메서드는 연산입니다 O(n) . 여기서 n 은 매개 변수의 요소 other 수입니다.

적용 대상