Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static IEnumerable<IEnumerable<T>> Chunk<T>(this IEnumerable<T> source, int chunksize)
- {
- while (source.Any())
- {
- yield return source.Take(chunksize);
- source = source.Skip(chunksize);
- }
- }
Add Comment
Please, Sign In to add comment