HashSet<T>.IntersectWith(IEnumerable<T>) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Modifies the current HashSet<T> object to contain only elements that are present in that object and in the specified collection.
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))
Parameters
- other
- IEnumerable<T>
The collection to compare to the current HashSet<T> object.
Implements
- Attributes
Exceptions
other
is null
.
Remarks
If the collection represented by the other
parameter is a HashSet<T> collection with the same equality comparer as the current HashSet<T> object, this method is an O(n
) operation. Otherwise, this method is an O(n
+ m
) operation, where n
is Count and m
is the number of elements in other
.