Currently I am performing join on two tables, the result could be multiple rows.
The return type is IList<string> currently but I am getting an error
Error:
Cannot implicitly convert type System.Collections.Generic.List<AnonymousType#1> to System.Collections.Generic.IList<string>
Here is my expression
public IList<string> GetPendingSubGroups()
{
using (var db = new DataClasses1DataContext())
{
var pendingSubGroup =
db.sys_Log_Account_SubGroups.Where(subGroup => subGroup.cAuthorizedStatus.Equals("Pending")).Join(
db.sys_Account_Primary_Groups, subGroup => subGroup.nGroupCode, group => group.nGroupCode,
(subGroup, group) => new
{
cSubGroupName = subGroup.cSubGroupName,
cAddedBy = subGroup.cAddedBy,
dAddedOn = subGroup.dAddedOn
}).ToList();
return pendingSubGroup;
}
}
Can anyone help me out with this?
Create a class to represent your result
And return a list of that class
note this change buried in the linq