Wintellect.PowerCollections Namespace
Algorithms Class
Algorithms Methods
GhostDoc Pro Sample Help File

Algorithms..::..Count<(Of <(<'T>)>)> Method

Count the number of items in an IEnumerable<T> collection. If a more specific collection type is being used, it is more efficient to use the Count property, if one is provided.

Namespace:  Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax


public static int Count<T>(
	IEnumerable<T> collection
)
Public Shared Function Count(Of T) ( _
	collection As IEnumerable(Of T) _
) As Integer
public:
generic<typename T>
static int^ Count(
	IEnumerable<T>^ collection
)

Type Parameters

T

Parameters

collection
Type: IEnumerable<(Of <(<'T>)>)>
The collection to count items in.

Return Value

The number of items in the collection.

Exceptions


ExceptionCondition
ArgumentNullExceptioncollection is null.

Remarks


If the collection implements ICollection<T>, this method simply returns ICollection<T>.Count. Otherwise, it enumerates all items and counts them.