using System.Collections.Generic;
public static void Main(string[] args)
List<Item> items = new List<Item>
new Item { Id = 1, Value = 12},
new Item { Id = 1, Value = 900 },
new Item { Id = 1231, Value = 0 },
new Item { Id = 1, Value = 577 }
List<Item> nonDupes = items.GroupBy(x => x.Id).Select(x => x.First()).ToList();
List<Item> dupes = items.Except(nonDupes).ToList();
Console.WriteLine("non-dupes: [[{0}]]", string.Join("], [", nonDupes));
Console.WriteLine("dupes: [[{0}]]", string.Join("], [", dupes));
public int Id { get; set; }
public int Value { get; set; }
public override string ToString()
return string.Format("Id: {0}, Value: {1}", Id, Value);