I have 2 lists of ManualReadTag
objects: _manualReadTagList
and mrt
. The entries in mrt
are a subset of _manualReadTagList
. I need to get every entry from _manualReadTagList
that is "NOT" present in the mrt
. So this is how I did it:
IEnumerable<ManualReadTag> difference = _manualReadTagList.Except(mrt).ToList();
But this is not working. I get all the records in the _manualReadTagList and not just whatever is not in the mrt. Below is how I fill the mrt
var mrt = (from ManualReadTag row in ViewingGridFromComparison.ItemsSource
select new ManualReadTag
{
Plaza = Convert.ToInt16(row.Plaza),
Lane = Convert.ToInt16(row.Lane),
Trxn_DTime = Convert.ToDateTime(row.Trxn_DTime),
Tag_Number = row.Tag_Number
}).ToList();
IEnumerable<ManualReadTag> difference = _manualReadTagList.Except(mrt).ToList();
ViewingGrid.ItemsSource = difference;
Can you please show me how to do this correctly. Thank you.