using System.Collections.Generic;
public static void Main()
List<Items> items = new List<Items>(){
new Items(1, 10, 20, 30, 40, 50),
new Items(2, 10, 19, 30, 40, 50),
new Items(3, 9, 20, 40, 30, 50),
new Items(4, 10, 20, 31, 40, 12),
new Items(5, 9, 20, 30, 40, 50),
new Items(6, 9, 20, 41, 40, 12)
var groupedItems = items.GroupBy(i => new { i.ItemA, i.ItemB })
for(var g = 0; g < groupedItems.Count(); g++)
Console.Write("List[{0}]: ",g);
foreach(var innerGroup in groupedItems.ElementAt(g))
Console.Write("{{{0}}},",String.Join(",",innerGroup.ToArray()));
public string Id { get; set;}
public string ItemA { get; set;}
public string ItemB { get; set;}
public string ItemC { get; set;}
public string ItemD { get; set;}
public string ItemE { get; set;}
public Items(int id, int a, int b, int c, int d, int e)
public string[] ToArray()
return new string[]{ Id, ItemA, ItemB, ItemC, ItemD, ItemE };