# | Line 26 | Line 26 | namespace libxmltv | |
---|---|---|
26 | } | |
27 | } | |
28 | ||
29 | + | public static class extensions |
30 | + | { |
31 | + | /// <summary> |
32 | + | /// Break a list of items into chunks of a specific size |
33 | + | /// </summary> |
34 | + | public static IEnumerable<IEnumerable<T>> Chunk<T>(this IEnumerable<T> source, int chunksize) |
35 | + | { |
36 | + | while (source.Any()) |
37 | + | { |
38 | + | yield return source.Take(chunksize); |
39 | + | source = source.Skip(chunksize); |
40 | + | } |
41 | + | } |
42 | + | } |
43 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |