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 159 by william, Thu Mar 14 20:26:05 2013 UTC vs.
Revision 196 by william, Sat Mar 16 21:53:19 2013 UTC

# 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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines