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: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static int Count<T>(
IEnumerable<T> collection
)
public:
generic<typename T>
static int Count(
IEnumerable<T>^ collection
)
Parameters
- collection
- Type: System.Collections.GenericIEnumerableT
The collection to count items in.
Type Parameters
- T
[Missing <typeparam name="T"/> documentation for "M:X3Platform.Collections.Algorithms.Count``1(System.Collections.Generic.IEnumerable{``0})"]
Return Value
Type:
Int32The number of items in the collection.
Exceptions
RemarksIf the collection implements ICollection<T>, this method
simply returns ICollection<T>.Count. Otherwise, it enumerates all items
and counts them.
See Also