ParallelEnumerable.ElementAt<TSource>(ParallelQuery<TSource>, Int32) 方法

定义

返回并行序列中指定索引处的元素。Returns the element at a specified index in a parallel sequence.

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

类型参数

TSource

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

参数

source
ParallelQuery<TSource>

要从中返回元素的序列。A sequence to return an element from.

index
Int32

要检索的从零开始的元素索引。The zero-based index of the element to retrieve.

返回

TSource

源序列中指定位置处的元素。The element at the specified position in the source sequence.

异常

已使用通过 WithCancellation 传递的令牌取消了查询。The query was canceled with the token passed in through WithCancellation.

source 为 null 引用(在 Visual Basic 中为 Nothing)。source is a null reference (Nothing in Visual Basic).

index 小于零或大于等于 source 中的元素数量。index is less than 0 or greater than or equal to the number of elements in source.

评估查询期间发生一个或多个异常。One or more exceptions occurred during the evaluation of the query.

适用于

另请参阅