In order to support an API that only accepts a specific amount of items (5 items), I want to transform a LINQ result into smaller groups of items that always contain that se
var list = new List { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; var result = new List>(); while (list.Count != 0) { result.Add(list.TakeWhile(x => x++ <= 5).ToList()); list.RemoveRange(0, list.Count < 5 ? list.Count : 5); }