--- trunk/libxmltv/Extensions.cs 2013/03/14 13:08:20 141 +++ trunk/libxmltv/Extensions.cs 2013/03/16 21:53:19 196 @@ -5,7 +5,7 @@ using System.Text; namespace libxmltv { - internal static class DateTimeStringConverter + public static class DateTimeStringConverter { private const string DEFAULT_DATE_FORMAT = "yyyy/MM/dd hh:mm tt"; public static string ToDateTimeString(this DateTime dt) @@ -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); + } + } + } } |