PayloadChunking.ChunkBySize<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Splits items into sub-batches whose cumulative estimated size stays under
maxChunkBytes.
Invariants:
- Input order is preserved across chunks.
- Empty input produces empty output.
- A single item whose size exceeds
maxChunkBytesforms its own single-item chunk (never silently dropped). - No chunk is ever empty.
public static System.Collections.Generic.List<System.Collections.Generic.List<T>> ChunkBySize<T>(System.Collections.Generic.IEnumerable<T> items, Func<T,long> getSize, long maxChunkBytes);
static member ChunkBySize : seq<'T> * Func<'T, int64> * int64 -> System.Collections.Generic.List<System.Collections.Generic.List<'T>>
Public Shared Function ChunkBySize(Of T) (items As IEnumerable(Of T), getSize As Func(Of T, Long), maxChunkBytes As Long) As List(Of List(Of T))
Type Parameters
- T
Item type.
Parameters
- items
- IEnumerable<T>
The items to chunk.
- maxChunkBytes
- Int64
Upper bound on cumulative estimated size per chunk.
Returns
An ordered list of non-empty chunks.