Today i have read on stackoverflow some user that ask how to divide a list into equal part.
So i have decided to write on my blog the code that can help someone.

const int maxSize = 500;
for (int i = 0; i < theList.Count(); i += maxSize) { int takePart = (theList.Count() - i) < maxSize? theList.Count() - i : maxSize; Class[] arrayPart = (from G in theList.Skip(i).Take(maxSize) select new Class {}).toArray(); }

I hope that can help!
Peace and Code!


Leave a Reply

Your email address will not be published. Required fields are marked *