How to compare two generic lists in C# 3.0? [duplicate]
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: Is there a built-in method to compare collections in C#? What is the best way to compare to generic two generic lists in C# 3.0? 回答1: If you want to compare regardless of element order, try the UnorderedEqual<T> method from here: C# List Element Equality Otherwise: var list1 = new List<int> { 1, 2, 3 }; var list2 = new List<int> { 1, 2, 3 }; var areSame = Enumerable.SequenceEqual(list1, list2); 回答2: Check out