using System.Collections.Generic;
public int Id {get; set; }
public string Data {get; set;}
public static void Main()
List<Foo> x = new List<Foo> { new Foo {Id = 1, Data = "1-one"}, new Foo {Id = 1, Data = "1-two"}, new Foo {Id = 2, Data = "2-one"} };
foreach (var g in x.GroupBy(i => i.Id)) {