Possible Duplicate:
Split List into Sublists with LINQ
Split a collection into n parts with LINQ?
I have an array like this:
[1,2,4,5.....n]
I would like to convert it in sub arrays like this:
[
[1,2,3],
[4,5,6],
...
]
Basically I want to group the array in groups of n members
Is there any LINQ function to help me to accomplish this??
I was thinking in the GroupBy
or SelectMany
but I have not figured out how to do it
Note, I already did this using a foreach
statement, but I would like to do it using LINQ