public static bool AreAnyDuplicates<T>(this IEnumerable<T> list) { var hashset = new HashSet<T>(); return list.Any(e => !hashset.Add(e)); }