Redigera

Dela via


AsyncEnumerable.UnionBy Method

Definition

Overloads

UnionBy<TSource,TKey>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Produces the set union of two sequences according to a specified key selector function.

UnionBy<TSource,TKey>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>)

Produces the set union of two sequences according to a specified key selector function.

UnionBy<TSource,TKey>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TSource>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Source:
UnionBy.cs

Produces the set union of two sequences according to a specified key selector function.

public static System.Collections.Generic.IAsyncEnumerable<TSource> UnionBy<TSource,TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> first, System.Collections.Generic.IAsyncEnumerable<TSource> second, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member UnionBy : System.Collections.Generic.IAsyncEnumerable<'Source> * System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function UnionBy(Of TSource, TKey) (first As IAsyncEnumerable(Of TSource), second As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TSource)

Type Parameters

TSource

The type of the elements of the input sequences.

TKey

The type of key to identify elements by.

Parameters

first
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> whose distinct elements form the first set for the union.

second
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> whose distinct elements form the second set for the union.

keySelector
Func<TSource,TKey>

A function to extract the key for each element.

comparer
IEqualityComparer<TKey>

The IEqualityComparer<T> to compare values.

Returns

IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> that contains the elements from both input sequences, excluding duplicates.

Exceptions

second is null.

Applies to

UnionBy<TSource,TKey>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TSource>, Func<TSource,CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>)

Source:
UnionBy.cs

Produces the set union of two sequences according to a specified key selector function.

public static System.Collections.Generic.IAsyncEnumerable<TSource> UnionBy<TSource,TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> first, System.Collections.Generic.IAsyncEnumerable<TSource> second, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TKey>> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member UnionBy : System.Collections.Generic.IAsyncEnumerable<'Source> * System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function UnionBy(Of TSource, TKey) (first As IAsyncEnumerable(Of TSource), second As IAsyncEnumerable(Of TSource), keySelector As Func(Of TSource, CancellationToken, ValueTask(Of TKey)), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TSource)

Type Parameters

TSource

The type of the elements of the input sequences.

TKey

The type of key to identify elements by.

Parameters

first
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> whose distinct elements form the first set for the union.

second
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> whose distinct elements form the second set for the union.

keySelector
Func<TSource,CancellationToken,ValueTask<TKey>>

A function to extract the key for each element.

comparer
IEqualityComparer<TKey>

The IEqualityComparer<T> to compare values.

Returns

IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> that contains the elements from both input sequences, excluding duplicates.

Exceptions

second is null.

Applies to