AsyncEnumerable.UnionBy 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.
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
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
An IAsyncEnumerable<T> that contains the elements from both input sequences, excluding duplicates.
Exceptions
second
is null
.