I am attempting to split a list into a series of smaller lists.
My Problem: My function to split lists doesn\'t split them into lists of the correct
Serj-Tm solution is fine, also this is the generic version as extension method for lists (put it into a static class):
public static List> Split(this List items, int sliceSize = 30)
{
List> list = new List>();
for (int i = 0; i < items.Count; i += sliceSize)
list.Add(items.GetRange(i, Math.Min(sliceSize, items.Count - i)));
return list;
}