I have two lists as below, how can I say that they have the same elements. The order is not important.
var list1 = new List {1,2,3}; var list2 = n
Without using linq.
private static bool AreListsEqual(List list1, List list2) { var areListsEqual = true; if (list1.Count != list2.Count) return false; for (var i = 0; i < list1.Count; i++) { if (list2[i] != list1[i]) { areListsEqual = false; } } return areListsEqual; }