Miner.Responder.Shared Assembly > Miner.Responder.Shared.Extensions Namespace > EnumerableExtensions Class : Chunkify<T> Method |
'Declaration <ExtensionAttribute()> Public Shared Function Chunkify(Of T)( _ ByVal source As IEnumerable(Of T), _ ByVal chunkSize As Integer _ ) As IEnumerable(Of IList(Of T))
'Usage Dim source As IEnumerable(Of T) Dim chunkSize As Integer Dim value As IEnumerable(Of IList(Of T)) value = EnumerableExtensions.Chunkify(Of T)(source, chunkSize)
[Extension()] public static IEnumerable<IList<T>> Chunkify<T>( IEnumerable<T> source, int chunkSize )
[ 1, 2, 3, 4, 5 ] => [ [ 1, 2, 3 ], [ 4, 5 ] ]
Keep in mind, this simple implementation is not optimal for all situations. It is suitable for small sequences, yet may not be memory efficient for large sequences, and definitely not acceptable for infinite sequences.
See %% for a discussion of different approaches to chunking.
[ 1, 2, 3, 4, 5 ] => [ [ 1, 2, 3 ], [ 4, 5 ] ]
Target Platforms: Windows XP SP3 (32-bit and 64-bit), Windows 7 (32-bit and 64-bit)
Not all Operating Systems are supported on all products. Visit the ArcFM Solution Supported Versions page for full details.