using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; public class Test { public static void Main() { Random r = new Random(DateTime.Now.Millisecond); Dictionary seed = Enumerable.Range(65, 26).ToDictionary(x => (Char)x, x => r.Next(10) % 5 != 0 ? r.Next(65536) : 1); List sample = new List(); foreach (KeyValuePair kvp in seed) { for (Int32 i = 0; i < kvp.Value; i++) { sample.Add(kvp.Key); } } Stopwatch sw = new Stopwatch(); sw.Start(); var result = sample.GroupBy (x => x).Where(x => x.Count() == 1).Select (x => x.Key); sw.Stop(); Console.WriteLine(String.Format("{0} to go through {1} records.", sw.Elapsed, sample.Count)); Console.WriteLine(String.Format("Result: {0}", String.Join(", ", result.Select(x => x.ToString()).ToArray()))); } }