AsyncEnumerable.IntersectBy Method (System.Linq) (original) (raw)
Source:
Source:
Produces the set intersection of two sequences according to a specified key selector function.
public static System.Collections.Generic.IAsyncEnumerable<TSource> IntersectBy<TSource,TKey>(this System.Collections.Generic.IAsyncEnumerable<TSource> first, System.Collections.Generic.IAsyncEnumerable<TKey> second, Func<TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TKey>> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member IntersectBy : System.Collections.Generic.IAsyncEnumerable<'Source> * System.Collections.Generic.IAsyncEnumerable<'Key> * Func<'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Key>> * System.Collections.Generic.IEqualityComparer<'Key> -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function IntersectBy(Of TSource, TKey) (first As IAsyncEnumerable(Of TSource), second As IAsyncEnumerable(Of TKey), 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
Returns
A sequence that contains the elements that form the set intersection of two sequences.
Exceptions
Remarks
This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated either by calling its `GetEnumerator` method directly or by using `foreach` in Visual C# or `For Each` in Visual Basic.
The intersection of two sets A and B is defined as the set that contains all the elements of A that also appear in B, but no other elements.
When the object returned by this method is enumerated, `Intersect` yields distinct elements occurring in both sequences in the order in which they appear in first
.
If comparer
is null
, the default equality comparer, Default, is used to compare values.