using System; using System.Globalization; using System.Linq; using System.Collections; using System.Collections.Generic; public class Test { public static void Main() { int[] numbers = {1,2,2,3,3,4,4,5}; var allUniques = numbers.GroupBy(i => i) .Where(group => !group.CountMoreThan(1)) .Select(group => group.Key).ToList(); foreach(int i in allUniques) Console.WriteLine(i); } } public static class Extensions { public static bool CountMoreThan(this IEnumerable source, int num) { if (source == null) throw new ArgumentNullException("source"); if (num < 0) throw new ArgumentException("num must be grater or equal 0", "num"); ICollection collection = source as ICollection; if (collection != null) { return collection.Count > num; } ICollection collection2 = source as ICollection; if (collection2 != null) { return collection2.Count > num; } int count = 0; using (IEnumerator enumerator = source.GetEnumerator()) { while (++count <= num + 1) if (!enumerator.MoveNext()) return false; } return true; } }