--- trunk/libxmltv/Extensions.cs 2013/03/14 20:26:05 159 +++ trunk/libxmltv/Extensions.cs 2013/03/16 21:53:19 196 @@ -26,4 +26,18 @@ namespace libxmltv } } + public static class extensions + { + /// <summary> + /// Break a list of items into chunks of a specific size + /// </summary> + 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); + } + } + } } |