Apart from the Distinct
extension method of LINQ, you could use a HashSet<T> object that you initialise with your collection. This is most likely more efficient than the LINQ way, since it uses hash codes (GetHashCode
) rather than an IEqualityComparer
).
In fact, if it's appropiate for your situation, I would just use a HashSet
for storing the items in the first place.