I want to compare two List of different lengths and/or same length. The first list is considered the Original list. The 2nd list is the Updated list. The second list may be the same but ordered differently.
I would like to keep track of additions and subtractions from the list. If something was removed it could be added to a removed collection and vice versa.
Below is an example of each list with an input
Original List Updated List
============= ============
Jim Tom
Tom Mike
Mike Harry
Sue Sue
Kim Roger
Roger
This is an desired output:
Addition List Subtraction List
============= ================
Harry Jim
Kim
If you have Ideas I would be glad to hear them!
Use LINQ.
var diff1 = List1.Except(List2);
var diff2 = 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