語言

HashSet<T>.IntersectWith(IEnumerable<T>) 方法

定義

修改目前 HashSet<T> 物件,只包含該物件及其指定集合中存在的元素。

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

參數

other
IEnumerable<T>

將收藏與當前 HashSet<T> 物件做比較。

實作

屬性

例外狀況

other 是 null。

備註

若參數所代表other的集合與當前HashSet<T>物件具有相同的等號比較器,HashSet<T>則此方法為 O(n) 運算。 否則,此方法為 O(n + m) 運算,其中 n 是 Count ,是 m 中的 other元素數。

適用於