/[xmltv_parser]/trunk/libxmltv/Extensions.cs
ViewVC logotype

Diff of /trunk/libxmltv/Extensions.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/libxmltv/Extensions.cs	2013/03/16 21:44:30	195
+++ trunk/libxmltv/Extensions.cs	2013/03/16 21:53:19	196
@@ -26,4 +26,18 @@
         }
     }
 
+    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);
+            }
+        }
+    }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22