ParallelEnumerable.Last 方法

定义

返回并行序列中的最后一个元素。Returns the last element of a parallel sequence.

重载

Last<TSource>(ParallelQuery<TSource>)

返回并行序列中的最后一个元素。Returns the last element of a parallel sequence.

Last<TSource>(ParallelQuery<TSource>, Func<TSource,Boolean>)

返回并行序列中满足指定条件的最后一个元素。Returns the last element of a parallel sequence that satisfies a specified condition.

Last<TSource>(ParallelQuery<TSource>)

返回并行序列中的最后一个元素。Returns the last element of a parallel sequence.

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

类型参数

TSource

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

参数

source
ParallelQuery<TSource>

要从中返回最后一个元素的序列。The sequence to return the last element from.

返回

TSource

源序列中最后位置处的值。The value at the last 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).

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

source 中不包含任何元素。source contains no elements.

注解

如果查询未排序,则最后一个元素是非确定性的。If the query is not ordered, then the last element is non-deterministic. 有关详细信息,请参阅 PLINQ 中的顺序保留For more information, see Order Preservation in PLINQ.

另请参阅

Last<TSource>(ParallelQuery<TSource>, Func<TSource,Boolean>)

返回并行序列中满足指定条件的最后一个元素。Returns the last element of a parallel sequence that satisfies a specified condition.

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

类型参数

TSource

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

参数

source
ParallelQuery<TSource>

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

predicate
Func<TSource,Boolean>

用于测试每个元素是否满足条件的函数。A function to test each element for a condition.

返回

TSource

序列中通过指定谓词函数中的测试的最后一个元素。The last element in the sequence that passes the test in the specified predicate function.

异常

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

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

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

source 中没有元素满足 predicate 中的条件。No element in source satisfies the condition in predicate.

注解

如果查询未排序,则最后一个元素是非确定性的。If the query is not ordered, then the last element is non-deterministic. 有关详细信息,请参阅 PLINQ 中的顺序保留For more information, see Order Preservation in PLINQ.

另请参阅

适用于