Enumerable.LongCount(TSource) Method (IEnumerable(TSource), Func(TSource, Boolean))
Silverlight
Returns an Int64 that represents how many elements in a sequence satisfy a condition.
Namespace: System.Linq
Assembly: System.Core (in System.Core.dll)
Type Parameters
- TSource
The type of the elements of source.
Parameters
- source
- Type: System.Collections.Generic.IEnumerable(TSource)
An IEnumerable(T) that contains the elements to be counted.
- predicate
- Type: System.Func(TSource, Boolean)
A function to test each element for a condition.
Return Value
Type: System.Int64A number that represents how many elements in the sequence satisfy the condition in the predicate function.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(TSource). When you use instance method syntax to call this method, omit the first parameter.| Exception | Condition |
|---|---|
| ArgumentNullException | source or predicate is a null reference (Nothing in Visual Basic). |
| OverflowException | The number of matching elements exceeds MaxValue. |
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Community Additions
ADD
Show: