I am trying to join two different list together using the Concat Method as shown below. I need the second list to be added to the first list, so that it can come as one lIst.
var term = dc.AgentTerm(Agentcode).ToList();
var hosp = dc.AgentHospCashPlan(Agentcode).ToList();
var life = term.Concat(hosp).ToList();
But when i tried it, I get this error.
Error 16 Instance argument: cannot convert from
System.Collections.Generic.List<IbsMobile.AgentTerm_Result>
toSystem.Linq.IQueryable<IbsMobile.AgentHospCashPlan_Result>
C:\Project\IbsMobile\IbsMobile\Controllers\ParamController.cs 506 24 IbsMobileError 17
System.Collections.Generic.List<IbsMobile.AgentTerm_Result>
does not contain a definition for 'Concat' and the best extension method overloadSystem.Linq.Queryable.Concat<TSource>(System.Linq.IQueryable<TSource>, System.Collections.Generic.IEnumerable<TSource>)
has some invalid arguments C:\Project\IbsMobile\IbsMobile\Controllers\ParamController.cs 506 24 IbsMobile
I checked online and all I see is how to convert 'System.Linq.IQueryable' to 'System.Collections.Generic.IList'.
The results that I'm assigning to term and Hosp are from stored procedures.
I have used the concat method before on lists with the same class and it worked fine.
I am guessing this error is because the results sets are from different classes.
I know this is a novice question but I'm not sure exactly what I'm doing wrong.