I have two Lists, and I've values in these as,
List1 List2
----- -----
1 1
2 2
3
I've to compare the second list with the first list, and I've to return the values which is not in the List1(here "3"), how can we compare two lists like this?
can anyone help me?
Use LINQ and the Except extension method.
var list1 = new List<int> { 1, 2 };
var list2 = new List<int> { 1, 2, 3 };
var remaining = list2.Except(list1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With