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

定义

从并行序列的开头返回指定数量的连续元素。Returns a specified number of contiguous elements from the start of a parallel sequence.

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

类型参数

TSource

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

参数

source
ParallelQuery<TSource>

要从其返回元素的序列。The sequence to return elements from.

count
Int32

要返回的元素数量。The number of elements to return.

返回

一个序列,其中包含从输入序列开始处起的指定数量的元素。A sequence that contains the specified number of elements from the start of the input sequence.

异常

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

适用于

另请参阅