I have 2 var/objects, retrieving thru these 2 functions:
private IQueryable SelectAll_1(...)
{
return query;
}
class Pro
The problem is that P2
is an IQueryable
while P3
is an IQueryable
and you can't union them into one sequence, since they are of different type.
What you need to do is to project both of them into one common type with a Select()
call which as far as I know must be a named type according to Jon Skeet can be done with an anonymous type. The initialization blocks that define the anonymous types must have the same number of members, with the same name, in the same order, with the same types to be treated as one type. To project the types with Select()
you also need to make the properties public to be accessible for the linq methods.