Reputation: 323
I currently have two lists
List<string> original = new List<string>();
List<string> edited = new List<string>();
List A List B
------ ------
1 1
2 2
3
I want to grab and display the value that is unable to be matched after comparing (which is 3
in the above example)
Upvotes: 1
Views: 56
Reputation: 18127
var notMatched = original.Except(edited).ToList();
EDIT:
If you have multiple mismatched values with same value and want to be shown just once:
var notMatched = original.Except(edited).Distinct().ToList();
Upvotes: 3
Reputation: 5101
i am not really familiar and into using of lambda expressions. i was thinking of using a foreach perhaps.
Don't need a loop.
List<string> deletedStuff= new List<string>();
deletedStuff.AddRange( original.FindAll( x => ! edited.Contains( x ) ).AsEnumerable());
Upvotes: 0