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,
As you have created an anonymous(Anonymous types are generated by the compiler, so we cannot know the type name in our codes) class so that you can not return it.Create a separate class with three properties Id,Name and Address then returned it.
public class Contact
{
public int Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
}
private IList GetJoinAAndB()
{
var query = from a in objA
join b in objB
on a.ID equals b.AID
select new Contact{ a.ID, a.Name, b.Address };
return query.ToList();
}