by Mikael Henriksson
5. June 2010 18:32
I admit it does not work for everything and only in C# 4 but it’s a useful extension none the less.
public static IEnumerable<T> RemoveDuplicates<T>(this IEnumerable<T> items)
{
return new HashSet<T>(items);
}
The hash set does not allow duplicates!
a8e7515c-2efd-4e6c-85a1-4d979ba9e956|1|5.0
Tags: linq, C#
LINQ | C#