ParallelEnumerable.Select 方法

定义

将序列中的每个元素并行投影到新窗体中。Projects in parallel each element of a sequence into a new form.

重载

Select<TSource,TResult>(ParallelQuery<TSource>, Func<TSource,Int32,TResult>)

通过合并元素的索引,将序列的每个元素并行投影到新窗体中。Projects in parallel each element of a sequence into a new form by incorporating the element's index.

Select<TSource,TResult>(ParallelQuery<TSource>, Func<TSource,TResult>)

将序列中的每个元素并行投影到新窗体中。Projects in parallel each element of a sequence into a new form.

Select<TSource,TResult>(ParallelQuery<TSource>, Func<TSource,Int32,TResult>)

通过合并元素的索引,将序列的每个元素并行投影到新窗体中。Projects in parallel each element of a sequence into a new form by incorporating the element's index.

public:
generic <typename TSource, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TResult> ^ Select(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, int, TResult> ^ selector);
public static System.Linq.ParallelQuery<TResult> Select<TSource,TResult> (this System.Linq.ParallelQuery<TSource> source, Func<TSource,int,TResult> selector);
static member Select : System.Linq.ParallelQuery<'Source> * Func<'Source, int, 'Result> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function Select(Of TSource, TResult) (source As ParallelQuery(Of TSource), selector As Func(Of TSource, Integer, TResult)) As ParallelQuery(Of TResult)

类型参数

TSource

source 的元素类型。The type of the elements of source.

TResult

选择器返回的元素的类型。The type of elements returned by selector.

参数

source
ParallelQuery<TSource>

一个值序列,要对该序列调用转换函数。A sequence of values to invoke a transform function on.

selector
Func<TSource,Int32,TResult>

应用于每个元素的转换函数。A transform function to apply to each element.

返回

ParallelQuery<TResult>

一个序列,其元素是基于为 source 所提供索引对 selector 中每个元素调用转换函数的结果。A sequence whose elements are the result of invoking the transform function on each element of source, based on the index supplied to selector.

异常

sourceselector 为 null 引用(在 Visual Basic 中为 Nothing)。source or selector 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.

该查询枚举的元素超过了 MaxValue 个。More than MaxValue elements are enumerated by the query. 在流式处理方案中可能出现此情况。This condition might occur in streaming scenarios.

另请参阅

Select<TSource,TResult>(ParallelQuery<TSource>, Func<TSource,TResult>)

将序列中的每个元素并行投影到新窗体中。Projects in parallel each element of a sequence into a new form.

public:
generic <typename TSource, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TResult> ^ Select(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TResult> ^ selector);
public static System.Linq.ParallelQuery<TResult> Select<TSource,TResult> (this System.Linq.ParallelQuery<TSource> source, Func<TSource,TResult> selector);
static member Select : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Result> -> System.Linq.ParallelQuery<'Result>
<Extension()>
Public Function Select(Of TSource, TResult) (source As ParallelQuery(Of TSource), selector As Func(Of TSource, TResult)) As ParallelQuery(Of TResult)

类型参数

TSource

source 的元素类型。The type of the elements of source.

TResult

选择器返回的元素的类型。The type of elements returned by selector.

参数

source
ParallelQuery<TSource>

一个值序列,要对该序列调用转换函数。A sequence of values to invoke a transform function on.

selector
Func<TSource,TResult>

应用于每个元素的转换函数。A transform function to apply to each element.

返回

ParallelQuery<TResult>

一个序列,其元素是对 source 的每个元素调用转换函数的结果。A sequence whose elements are the result of invoking the transform function on each element of source.

异常

sourceselector 为 null 引用(在 Visual Basic 中为 Nothing)。source or selector 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.

另请参阅

适用于