Combining The Results Of Two Linq Queries Into A Single Var?

You can only combine enumerations of the same type, you could project both to a common class and then concatenate them:

var result1 = db1.table.Where(a=>a.value>0).Select( x=> new Foo() { /*set props*/ });
var result2 = db2.table.Where(a=>a.value>0).Select( x=> new Foo() { /*set props*/ });

var resultSum = result1.Concat(result2);

Leave a Comment