I am trying to split a collection into multiple collections while maintaining a sort I have on the collection. I have tried using the following extension method, but it breaks
public static IEnumerable> Split(this IEnumerable list, int parts) { int nGroups = (int)Math.Ceiling(list.Count() / (double)parts); var groups = Enumerable.Range(0, nGroups); return groups.Select(g => list.Skip(g * parts).Take(parts)); }