TEnumerable.Intersect<T> Method

Overloads

Intersect<T>(IEnumerable<T>, IEnumerable<T>)

Produces the set intersection of two sequences by using the default equality comparer to compare values.

Intersect<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>)

Produces the set intersection of two sequences by using the specified equality comparer to compare values.

Intersect<T>(IEnumerable<T>, IEnumerable<T>)

Produces the set intersection of two sequences by using the default equality comparer to compare values.

Delphi
class function Intersect<T>(const first: IEnumerable<T>; const second: IEnumerable<T>): IEnumerable<T>

Type Parameters

T

The type of the elements of the input sequences.

Parameters

first
IEnumerable<T>

A sequence whose distinct elements that also appear in second will be returned.

second
IEnumerable<T>

A sequence whose distinct elements that also appear in first will be returned.

Returns

IEnumerable<T>

A sequence that contains the elements that form the set intersection of two sequences.

Exceptions

first or second is nil .

Intersect<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>)

Produces the set intersection of two sequences by using the specified equality comparer to compare values.

Delphi
class function Intersect<T>(const first: IEnumerable<T>; const second: IEnumerable<T>; const comparer: IEqualityComparer<T>): IEnumerable<T>

Type Parameters

T

The type of the elements of the input sequences.

Parameters

first
IEnumerable<T>

A sequence whose distinct elements that also appear in second will be returned.

second
IEnumerable<T>

A sequence whose distinct elements that also appear in first will be returned.

comparer
IEqualityComparer<T>

An equality comparer to compare values.

Returns

IEnumerable<T>

A sequence that contains the elements that form the set intersection of two sequences.

Exceptions

first or second is nil .

Remarks

If comparer is nil , the default equality comparer is used to compare values.