Chunk Method
Definition
- Namespace
- Cuemon.Extensions.Collections.Generic
- Assemblies
- Cuemon.Extensions.Collections.Generic.dll
Chunk<T>(IEnumerable<T>, int)
Returns a chunked IEnumerable<T> sequence with a maximum of the specified size. Default is 128.
public static PartitionerEnumerable<T> Chunk<T>(this IEnumerable<T> source, int size = 128)
Parameters
sourceIEnumerable<T>An IEnumerable<T> to extend.
sizeintThe amount of elements to process at a time.
Returns
- PartitionerEnumerable<T>
An IEnumerable<T> that contains no more than the specified
sizeof elements from thesourcesequence.
Type Parameters
TThe type of the elements of
source.
Remarks
The original source is reduced equivalent to the number of elements in the returned sequence.
Exceptions
- ArgumentNullException
sourceis null.- ArgumentException
sizeis less or equal to 0.