Possible Duplicate:
LINQ Partition List into Lists of 8 members
how do I chunk an enumerable?
I have a list of many items, and a Method that works well on shorter lists of those same items.
Can I use LINQ to pull off N elements from the big list, and pass them into the Method, N at a time? I'm sure there is an elegant way to to this without having to make an "int i=0;" variable.
Let me be clear, I know that foo.Take(10) will get me 10 items off the list. But I need to keep processing the next set of 10, then the next set of 10 and so on. The pseudo code should be something like:
var shortList = BigList.NiceMethod(10);
foreach (shorty in shortlist)
{
Method(shorty);
}
This is probably some Group call.