I have an IEnumerable. I want to chunk it up, ie say there are 500 elements, I want 10 50 element chunks out of it. I tried this
while (true)
{
var page = ret.Take(pagesize).ToList();
.. do stuff with page
}
but that starts at the beginning every time. I am happy with either the above model (an external loop over each page). Or soemting that looks like this
ret.ChunkIt(pagesize).Select(chunk => >do stuff with the page)
I would like to avoid something that materializes the whole list (it might be huge). Ie something that did
List<List<object>> chunks = ret.Chunkit(100);