score:21

Accepted answer

score:1

var result = ListOfLists.SelectMany(v => v).ToList().Distinct();

EDIT: For better performance, use:

var result = ListOfLists.SelectMany(v => v).Distinct();

or

var result = ListOfLists.SelectMany(v => v).Distinct().ToList();

score:5

For completeness, the query expression syntax is sometimes easier (I find) to come up with than the correct invocation of SelectMany. Here it would be:

result = (from list in ListOfLists
          from s in list
          select s).Distinct().ToList();

score:13

var distinctStrings = ListOfLists.SelectMany(list => list).Distinct();

Related Query

More Query from same tag