What is the return type of my linq query?
- by Ulhas Tuscano
I have two tables A & B. I can fire Linq queries & get required data for individual tables.
As i know what each of the tables will return as shown in example.
But, when i join both the tables i m not aware of the return type of the Linq query. This problem can be solved by creating a class which will hold ID,Name and Address properties inside it. but,everytime before writing a join query depending on the return type i will have to create a class which is not a convinient way
Is there any other mathod available to achieve this
private IList<A> GetA()
{
var query = from a in objA
select a;
return query.ToList();
}
private IList<B> GetB()
{
var query = from b in objB
select b;
return query.ToList();
}
private IList<**returnType**?> GetJoinAAndB()
{
var query = from a in objA
join b in objB
on a.ID equals b.AID
select new { a.ID, a.Name, b.Address };
return query.ToList();
}