NDepend.API Documentation
Intersect<T>(HashSet<T>,IEnumerable<T>) Method
NDepend.Helpers Namespace > ExtensionMethodsSet Class > Intersect Method : Intersect<T>(HashSet<T>,IEnumerable<T>) Method
The code element type of the elements of the hashset and the sequence.
An hashset of elements whose distinct elements that also appear in seq will be returned.
A sequence of elements whose distinct elements that also appear in hashset will be returned.
Produces the set of elements, intersection of this hashset and seq. This method is an optimized version of Enumerable.Intersect<T>.
Syntax
[Extension()]
public static IEnumerable<T> Intersect<T>( 
   HashSet<T> hashset,
   IEnumerable<T> seq
)

Parameters

hashset
An hashset of elements whose distinct elements that also appear in seq will be returned.
seq
A sequence of elements whose distinct elements that also appear in hashset will be returned.

Type Parameters

T
The code element type of the elements of the hashset and the sequence.

Return Value

A sequence that contains the elements that form the set intersection of the hashset and the sequence.
Remarks
This extension method has a O(seq.Count) time complexity.
Requirements

Target Platforms: Windows 11, 10, 8, 7 and Linux, MacOS with net8.0, net7.0 or net6.0 installed

See Also

Reference

ExtensionMethodsSet Class
ExtensionMethodsSet Members
Overload List