我有一个方法:
public DzieckoAndOpiekunCollection GetChildAndOpiekunByFirstnameLastname(string firstname, string lastname)
{
DataTransfer.ChargeInSchoolEntities db = new DataTransfer.ChargeInSchoolEntities();
DzieckoAndOpiekunCollection result = new DzieckoAndOpiekunCollection();
if (firstname == null && lastname != null)
{
IList<DzieckoAndOpiekun> resultV = from p in db.Dziecko
where lastname == p.Nazwisko
**select** new DzieckoAndOpiekun(
p.Imie,
p.Nazwisko,
p.Opiekun.Imie,
p.Opiekun.Nazwisko)
;
result.AddRange(resultV);
}
return result;
}
在选定的位置出现错误:
错误1 无法隐式将类型“System.Linq.IQueryable<WcfService1.DzieckoAndOpiekun>”转换为“System.Collections.Generic.IList<WcfService1.DzieckoAndOpiekun>”。存在显式转换(是否缺少强制转换?)
有什么解决方法吗?