I\'am trying to check the difference between two List in c#.
Example:
List FirstList = new List
Than for this king of reuqirement you can can make use of Except function.
List newlist = List1.Except(List2).ToList();
or you can do this , so the below one create new list three which contains items that are not common in list1 and list2
var common = List1.Intersect(List2);
var list3 = List1.Except(common ).ToList();
list3.AddRange(List2.Except(common ).ToList());
the above one is help full when list1 and list2 has differenct item like
List list1= new List();
List list2 = new List();
The FirstList is filled with the following values:
list1.Add("COM1");
list1.Add("COM2");
list1.Add("COM4");
The SecondList is filled with the following values:
list2 .Add("COM1");
list2 .Add("COM2");
list2 .Add("COM3");
by using above code list3 contains COM4 and COM3.