CopytoDataTable is throwing an exception in case of no rows are returned / forwarded to the method. But with checking on this before using CopytoDataTable we can handle this in a defensive way
Do I need to convert my datatable to a List first?
Because with the Linq Query im using above I am comparing 2 datatables.
I cant see how the Linq Query you wrote compares the two datatables?
I have not merged the datatables.
Is there a way to make it that when DT1.AsEnumerable().Except(DT2.AsEnumerable, DataRowComparer.Default).CopyToDataTable throws an exception then assign it a value.
DT1.AsEnumerable().Except(DT2.AsEnumerable, DataRowComparer.Default).ToList
then check the count as done in the pattern
based on the check you execute the CopyToDataTable
OR
Your clone it to reveive an empty datatable within the same column structure