4

I have a rather large list of strings that contains duplicates in the sense that if I only care if A,B,C are in a result, but not what order they are in. I looked for many other duplication removal solutions, but they typically only work for exact values(which I understand since these elements aren't exact dups, but more spurious or superfluous results.) I already have the list and didn't create it, so changing the selection is not an option.

1 Answers1

10

Simply sort the elements within each item first.

listOfStrings.Select(s => new string(s.OrderBy(c => c))).Distinct().ToList();

You see what I mean - sort the chars. I'll check the syntax of this momentarily..

Kieren Johnstone
  • 41,277
  • 16
  • 94
  • 144