Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# how to check if two lists have same values

var list1 = new List<int> { 1, 2, 3, 1 };
var list2 = new List<int> { 2, 1, 3, 1 };
var list3 = new List<int> { 2, 2, 3, 2 };
bool areTheSame1 = list1.SequenceEqualsIgnoreOrder(list2); //True
bool areTheSame2 = list1.SequenceEqual(list2); //True
bool areTheSame3 = list1.SequenceEqual(list3); //False
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #lists #values
ADD COMMENT
Topic
Name
9+3 =