Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Remove duplicates from a List<T> in C#

Anyone have a quick method for de-duplicating a generic List in C#?

1 Answer

If you're using .Net 3+, you can use Linq.

List<T> withDupes = LoadSomeData();
List<T> noDupes = withDupes.Distinct().ToList();

Login / Signup to Answer the Question.