using System.Collections.Generic;
public static class Program
public static void Main()
var items = new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j" };
var groupedItems = items.GroupBy(3).ToList();
groupedItems.ForEach(x =>
Console.WriteLine(x.Key);
x.ToList().ForEach(y => Console.WriteLine(" " + y));
public static IEnumerable<IGrouping<int, TSource>> GroupBy<TSource>
(this IEnumerable<TSource> source, int itemsPerGroup)
return source.Zip(Enumerable.Range(0, source.Count()),
(s, r) => new { Group = r / itemsPerGroup, Item = s })
.GroupBy(i => i.Group, g => g.Item)