ParallelEnumerable.Zip 方法
定义
通过使用指定的谓词函数并行合并两个序列。Merges in parallel two sequences by using the specified predicate function.
重载
| Zip<TFirst,TSecond,TResult>(ParallelQuery<TFirst>, IEnumerable<TSecond>, Func<TFirst,TSecond,TResult>) |
已过时。
切勿调用此 Zip 重载。This Zip overload should never be called. 此方法已标记为过时,调用此方法时总是会引发 NotSupportedException。This method is marked as obsolete and always throws NotSupportedException when invoked. |
| Zip<TFirst,TSecond,TResult>(ParallelQuery<TFirst>, ParallelQuery<TSecond>, Func<TFirst,TSecond,TResult>) |
通过使用指定的谓词函数并行合并两个序列。Merges in parallel two sequences by using the specified predicate function. |
Zip<TFirst,TSecond,TResult>(ParallelQuery<TFirst>, IEnumerable<TSecond>, Func<TFirst,TSecond,TResult>)
注意
The second data source of a binary operator must be of type System.Linq.ParallelQuery rather than System.Collections.Generic.IEnumerable. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery.
切勿调用此 Zip 重载。This Zip overload should never be called. 此方法已标记为过时,调用此方法时总是会引发 NotSupportedException。This method is marked as obsolete and always throws NotSupportedException when invoked.
public:
generic <typename TFirst, typename TSecond, typename TResult>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<TResult> ^ Zip(System::Linq::ParallelQuery<TFirst> ^ first, System::Collections::Generic::IEnumerable<TSecond> ^ second, Func<TFirst, TSecond, TResult> ^ resultSelector);
[System.Obsolete("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")]
public static System.Linq.ParallelQuery<TResult> Zip<TFirst,TSecond,TResult> (this System.Linq.ParallelQuery<TFirst> first, System.Collections.Generic.IEnumerable<TSecond> second, Func<TFirst,TSecond,TResult> resultSelector);
[<System.Obsolete("The second data source of a binary operator must be of type System.Linq.ParallelQuery<T> rather than System.Collections.Generic.IEnumerable<T>. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery<T>.")>]
static member Zip : System.Linq.ParallelQuery<'First> * seq<'Second> * Func<'First, 'Second, 'Result> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function Zip(Of TFirst, TSecond, TResult) (first As ParallelQuery(Of TFirst), second As IEnumerable(Of TSecond), resultSelector As Func(Of TFirst, TSecond, TResult)) As ParallelQuery(Of TResult)
类型参数
- TFirst
未使用此类型参数。This type parameter is not used.
- TSecond
未使用此类型参数。This type parameter is not used.
- TResult
未使用此类型参数。This type parameter is not used.
参数
- first
- ParallelQuery<TFirst>
未使用此参数。This parameter is not used.
- second
- IEnumerable<TSecond>
未使用此参数。This parameter is not used.
- resultSelector
- Func<TFirst,TSecond,TResult>
未使用此参数。This parameter is not used.
返回
- ParallelQuery<TResult>
此重载总是会引发 NotSupportedException。This overload always throws a NotSupportedException.
- 属性
例外
调用此方法时发生的异常。The exception that occurs when this method is called.
注解
此重载可禁止对类型为的左侧数据源使用 Zip ParallelQuery<TSource> ,并允许使用类型的正确数据源 IEnumerable<T> 。This overload exists to disallow usage of Zip with a left data source of type ParallelQuery<TSource> and a right data source of type IEnumerable<T>. 否则,Zip 运算符似乎绑定到并行实现,但实际上绑定到了顺序实现。Otherwise, the Zip operator would appear to be bind to the parallel implementation, but would in reality bind to the sequential implementation.
适用于
Zip<TFirst,TSecond,TResult>(ParallelQuery<TFirst>, ParallelQuery<TSecond>, Func<TFirst,TSecond,TResult>)
通过使用指定的谓词函数并行合并两个序列。Merges in parallel two sequences by using the specified predicate function.
public:
generic <typename TFirst, typename TSecond, typename TResult>
[System::Runtime::CompilerServices::Extension]
static System::Linq::ParallelQuery<TResult> ^ Zip(System::Linq::ParallelQuery<TFirst> ^ first, System::Linq::ParallelQuery<TSecond> ^ second, Func<TFirst, TSecond, TResult> ^ resultSelector);
public static System.Linq.ParallelQuery<TResult> Zip<TFirst,TSecond,TResult> (this System.Linq.ParallelQuery<TFirst> first, System.Linq.ParallelQuery<TSecond> second, Func<TFirst,TSecond,TResult> resultSelector);
static member Zip : System.Linq.ParallelQuery<'First> * System.Linq.ParallelQuery<'Second> * Func<'First, 'Second, 'Result> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function Zip(Of TFirst, TSecond, TResult) (first As ParallelQuery(Of TFirst), second As ParallelQuery(Of TSecond), resultSelector As Func(Of TFirst, TSecond, TResult)) As ParallelQuery(Of TResult)
类型参数
- TFirst
第一个序列中的元素的类型。The type of the elements of the first sequence.
- TSecond
第二个序列中的元素的类型。The type of the elements of the second sequence.
- TResult
返回元素的类型。The type of the return elements.
参数
- first
- ParallelQuery<TFirst>
要压缩的第一个序列。The first sequence to zip.
- second
- ParallelQuery<TSecond>
要压缩的第二个序列。The second sequence to zip.
- resultSelector
- Func<TFirst,TSecond,TResult>
用于从两个匹配元素创建结果元素的函数。A function to create a result element from two matching elements.
返回
- ParallelQuery<TResult>
一个序列,其中包含通过对两个序列执行 TResult 配对获得的 resultSelector 类型的元素。A sequence that has elements of type TResult that are obtained by performing resultSelector pairwise on two sequences. 如果序列长度不相等,这将截断为较短序列的长度。If the sequence lengths are unequal, this truncates to the length of the shorter sequence.
例外
first 或 second 或 resultSelector 是 null 引用(在 Visual Basic 中为 Nothing)。first or second or resultSelector is a null reference (Nothing in Visual Basic).
已使用通过 WithCancellation 传递的令牌取消了查询。The query was canceled with the token passed in through WithCancellation.
评估查询期间发生一个或多个异常。One or more exceptions occurred during the evaluation of the query.