Answers for "c# how find differences between two array lists"

C#
1

get waht is differnt between two arrays c#

//get whats in array 2 but not array 1
- array2.Except(array1)
//get whats in array 1 but not array 2
- array1.Except(array2)
//get what is in both array 1 and array 2
- array1.Intersect(array2)
Posted by: Guest on June-15-2020
3

difference two list c#

var list1 = new List<int> { 1, 2, 3, 4, 5};
var list2 = new List<int> { 3, 4, 5, 6, 7 };

var list3 = list1.Except(list2); //list3 contains only 1, 2
var list4 = list2.Except(list1); //list4 contains only 6, 7
var resultList = list3.Concat(list4).ToList(); //resultList contains 1, 2, 6, 7
Posted by: Guest on July-23-2020

Code answers related to "c# how find differences between two array lists"

C# Answers by Framework

Browse Popular Code Answers by Language