You could use Enumerable.Except
on these fields:
var sendIdentityFields = from s in sendTable.AsEnumerable()
select new
{
BUS = s.Field<int>("BUS"),
IDENT = s.Field<int>("IDENT"),
STATION = s.Field<int>("STATION"),
REF1 = s.Field<string>("REF1"),
REF2 = s.Field<string>("REF2"),
REF3 = s.Field<string>("REF3"),
REF4 = s.Field<string>("REF4"),
REF5 = s.Field<string>("REF5"),
REF6 = s.Field<string>("REF6"),
REF7 = s.Field<string>("REF7"),
REF8 = s.Field<string>("REF8")
};
var receivedIdentityFields = from r in sendTable.AsEnumerable()
select new
{
BUS = r.Field<int>("BUS"),
IDENT = r.Field<int>("IDENT"),
STATION = r.Field<int>("STATION"),
REF1 = r.Field<string>("REF1"),
REF2 = r.Field<string>("REF2"),
REF3 = r.Field<string>("REF3"),
REF4 = r.Field<string>("REF4"),
REF5 = r.Field<string>("REF5"),
REF6 = r.Field<string>("REF6"),
REF7 = r.Field<string>("REF7"),
REF8 = r.Field<string>("REF8")
};
var sendButNotReceived = sendIdentityFields.Except(receivedIdentityFields);
Of course this selects just the anonymous type with these fields and not DataRows
. If you need to select the DataRows
of sendTable
you need to join them with this result on the same fields.
4
solved How to use the Except in C# [closed]