That’s what sets (e.g., HashSet<T>) are for. Sets have no defined order, and SetEquals verifies whether the set and another collection contain the same elements.
var set = new HashSet<int>(list1);
var equals = set.SetEquals(list2);
That’s what sets (e.g., HashSet<T>) are for. Sets have no defined order, and SetEquals verifies whether the set and another collection contain the same elements.
var set = new HashSet<int>(list1);
var equals = set.SetEquals(list2);