ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/xmltv_parser/trunk/libxmltv/Extensions.cs
(Generate patch)

Comparing trunk/libxmltv/Extensions.cs (file contents):
Revision 141 by william, Thu Mar 14 13:08:20 2013 UTC vs.
Revision 196 by william, Sat Mar 16 21:53:19 2013 UTC

--- 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);
+            }
+        }
+    }
 }