TEnumerable.Union<T> Method
Overloads
| Union<T>(IEnumerable<T>, IEnumerable<T>) |
Produces the set union of two sequences by using the default equality comparer. |
| Union<T>(IEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>) |
Produces the set union of two sequences by using a specified equality comparer. |
Produces the set union of two sequences by using the default equality comparer.
class function Union<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 form the first set for the union.
- second
- IEnumerable<T>
A sequence whose distinct elements form the second set for the union.
Returns
A sequence that contains the elements from both input sequences, excluding duplicates.
Exceptions
first or second is nil .
Produces the set union of two sequences by using a specified equality comparer.
class function Union<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 form the first set for the union.
- second
- IEnumerable<T>
A sequence whose distinct elements form the second set for the union.
- comparer
- IEqualityComparer<T>
An equality comparer to compare values.
Returns
A sequence that contains the elements from both input sequences, excluding duplicates.
Exceptions
first or second is nil .
Remarks
If comparer is nil , the default equality comparer is
used to compare values.