ParallelEnumerable.All<TSource>(ParallelQuery<TSource>, Func<TSource,Boolean>) 方法

定义

并行确定序列中的所有元素是否都满足条件。Determines in parallel whether all elements of a sequence satisfy a condition.

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

类型参数

TSource

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

参数

source
ParallelQuery<TSource>

要对其应用谓词的元素所在的序列。A sequence whose elements to apply the predicate to.

predicate
Func<TSource,Boolean>

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

返回

如果源序列中的每个元素都通过指定谓词中的测试,或者序列为空,则为 true;否则为 falsetrue if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.

异常

已使用通过 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.

适用于

另请参阅