I currently have 2 queries that are returning lists of MyModel like this:
var q1 = ....
select new MyModel()
{
TheData1 = ...
As was pointed out if you are combining the lists with .Union(
) you will have to define uniqueness by using the overload passing an IEqualityComparer for your type.
var result = q1.Union(q2, myEqualityComparer);
otherwise, and easier you could use DistinctBy( x=> x.TheUniqueId)
from the MoreLinq project:
var result = q1.Concat(q2).DistinctBy(c => c.TheUniqueID);