AsyncEnumerable.IntersectBy 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
IntersectBy<TSource,TKey>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TKey>, Func<TSource,CancellationToken,ValueTask<TKey>>, IEqualityComparer<TKey>)
- Source:
- IntersectBy.cs
- Source:
- IntersectBy.cs
- Source:
- IntersectBy.cs
根据指定的键选择器函数生成两个序列的集交集。
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)
类型参数
- TSource
输入序列的元素的类型。
- TKey
要标识元素的键的类型。
参数
- first
- IAsyncEnumerable<TSource>
IAsyncEnumerable<T>将返回同时出现在second其中的不同元素。
- second
- IAsyncEnumerable<TKey>
将返回第一 IAsyncEnumerable<T> 个序列中显示的不同元素。
- keySelector
- Func<TSource,CancellationToken,ValueTask<TKey>>
用于提取每个元素的键的函数。
- comparer
- IEqualityComparer<TKey>
要比较键的一个 IEqualityComparer<T> 。
返回
包含构成两个序列集交集的元素的序列。
例外
keySelector 是 null。
注解
此方法是使用延迟执行实现的。 即时返回值是一个对象,用于存储执行操作所需的所有信息。 在枚举对象之前,不会执行此方法表示的查询,方法是直接调用其“GetEnumerator”方法,或在 visual C# 中使用“foreach”或在Visual Basic中使用“Foreach”。
两组 A 和 B 的交集定义为包含 A 的所有元素的集,这些元素也显示在 B 中,但没有其他元素。
当枚举此方法返回的对象时,“交错”将生成两个序列中出现的不同元素,其出现 first顺序。
comparer如果是null,则使用默认相等比较器Default来比较值。
适用于
IntersectBy<TSource,TKey>(IAsyncEnumerable<TSource>, IAsyncEnumerable<TKey>, Func<TSource,TKey>, IEqualityComparer<TKey>)
- Source:
- IntersectBy.cs
- Source:
- IntersectBy.cs
- Source:
- IntersectBy.cs
根据指定的键选择器函数生成两个序列的集交集。
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,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer = default);
static member IntersectBy : System.Collections.Generic.IAsyncEnumerable<'Source> * System.Collections.Generic.IAsyncEnumerable<'Key> * Func<'Source, '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, TKey), Optional comparer As IEqualityComparer(Of TKey) = Nothing) As IAsyncEnumerable(Of TSource)
类型参数
- TSource
输入序列的元素的类型。
- TKey
要标识元素的键的类型。
参数
- first
- IAsyncEnumerable<TSource>
IAsyncEnumerable<T>将返回同时出现在second其中的不同元素。
- second
- IAsyncEnumerable<TKey>
将返回第一 IAsyncEnumerable<T> 个序列中显示的不同元素。
- keySelector
- Func<TSource,TKey>
用于提取每个元素的键的函数。
- comparer
- IEqualityComparer<TKey>
要比较键的一个 IEqualityComparer<T> 。
返回
包含构成两个序列集交集的元素的序列。
例外
keySelector 是 null。
注解
此方法是使用延迟执行实现的。 即时返回值是一个对象,用于存储执行操作所需的所有信息。 在枚举对象之前,不会执行此方法表示的查询,方法是直接调用其“GetEnumerator”方法,或在 visual C# 中使用“foreach”或在Visual Basic中使用“Foreach”。
两组 A 和 B 的交集定义为包含 A 的所有元素的集,这些元素也显示在 B 中,但没有其他元素。
当枚举此方法返回的对象时,“交错”将生成两个序列中出现的不同元素,其出现 first顺序。
comparer如果是null,则使用默认相等比较器Default来比较值。