I had a run-time error when the following code was executed: (vb.net)
dim q = (From x in db.T1
select x.F11, x.F12).Union( _
(From y in db.T2
select y.F21, y.F22)
F11 and F21 have the same type; F21 and F22 have the same type.
The runtime error stated “Unable to cast from DataQuery(of anonymous type(…) to iEnumerable (of anonymous type…
Unionon anonymous types should work. Compiler is intelligent enough to treat two anonymous types are same. Double check your field types in database of tow tables they should be exactly sameYou can try union on same table to see this