I am writing an application where I have two objects that contain properties that are generic Lists (List<T>). I want to compare the two properties and make sure they contain the same elements (but not necessarily in the same order). For example:
List1: item1 item2 item3 List2: item2 item1 item3
This should result in them being considered "the same". But this can also happen
List1: item1 item2 item2 item3 List2: item2 item2 item3 item1
This should also be the same! Crazy, eh?
I know I could probably just brute-force it with a lot of foreach's but I was hoping there was a better way.