ParallelEnumerable.LongCount 方法
定义
返回一个 Int64,表示并行序列中的元素的总数。Returns an Int64 that represents the total number of elements in a parallel sequence.
重载
LongCount<TSource>(ParallelQuery<TSource>) |
返回一个 Int64,表示并行序列中的元素的总数。Returns an Int64 that represents the total number of elements in a parallel sequence. |
LongCount<TSource>(ParallelQuery<TSource>, Func<TSource,Boolean>) |
返回一个 Int64,表示并行序列中满足条件的元素的数量。Returns an Int64 that represents how many elements in a parallel sequence satisfy a condition. |
LongCount<TSource>(ParallelQuery<TSource>)
返回一个 Int64,表示并行序列中的元素的总数。Returns an Int64 that represents the total number of elements in a parallel sequence.
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static long LongCount(System::Linq::ParallelQuery<TSource> ^ source);
public static long LongCount<TSource> (this System.Linq.ParallelQuery<TSource> source);
static member LongCount : System.Linq.ParallelQuery<'Source> -> int64
<Extension()>
Public Function LongCount(Of TSource) (source As ParallelQuery(Of TSource)) As Long
类型参数
- TSource
source
的元素类型。The type of the elements of source
.
参数
- source
- ParallelQuery<TSource>
包含要计数的元素的序列。A sequence that contains elements to be counted.
返回
输入序列中的元素数量。The number of elements in the input 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).
源中的元素数大于 MaxValue。The number of elements in source is larger than MaxValue. 或评估查询期间发生一个或多个异常。-or- One or more exceptions occurred during the evaluation of the query.
另请参阅
适用于
LongCount<TSource>(ParallelQuery<TSource>, Func<TSource,Boolean>)
返回一个 Int64,表示并行序列中满足条件的元素的数量。Returns an Int64 that represents how many elements in a parallel sequence satisfy a condition.
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static long LongCount(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, bool> ^ predicate);
public static long LongCount<TSource> (this System.Linq.ParallelQuery<TSource> source, Func<TSource,bool> predicate);
static member LongCount : System.Linq.ParallelQuery<'Source> * Func<'Source, bool> -> int64
<Extension()>
Public Function LongCount(Of TSource) (source As ParallelQuery(Of TSource), predicate As Func(Of TSource, Boolean)) As Long
类型参数
- TSource
source
的元素类型。The type of the elements of source
.
参数
- source
- ParallelQuery<TSource>
包含要计数的元素的序列。A sequence that contains elements to be counted.
返回
一个数字,表示序列中满足谓词函数条件的元素数量。A number that represents how many elements in the sequence satisfy the condition in the predicate function.
例外
已使用通过 WithCancellation
传递的令牌取消了查询。The query was canceled with the token passed in through WithCancellation
.
source
或 predicate
为 null 引用(在 Visual Basic 中为 Nothing)。source
or predicate
is a null reference (Nothing in Visual Basic).
源中的元素数大于 MaxValue。The number of elements in source is larger than MaxValue. 或评估查询期间发生一个或多个异常。-or- One or more exceptions occurred during the evaluation of the query.