【发布时间】:2011-03-25 02:06:40
【问题描述】:
我有一个方法:
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
”隐式转换为“System.Collections.Generic.IList ”。存在显式转换(您是否缺少演员表?)
知道如何解决我的问题吗?
【问题讨论】:
标签: c# .net linq exception-handling linq-to-entities