【发布时间】:2010-11-18 05:07:35
【问题描述】:
刚刚学习 LINQ,我在我的测试项目中遇到了新手障碍。你能解释一下我做错了什么吗?
public List<ToDoListInfo> retrieveLists(int UserID)
{
//Integrate userid specification later - need to add listUser table first
IQueryable<ToDoListInfo> lists =
from l in db.ToDoLists
select new ToDoListInfo {
ListID = l.ListID,
ListName = l.ListName,
Order = l.Order,
Completed = l.Completed
};
return lists.ToList<ToDoListInfo>;
}
我收到一条错误消息:
无法将方法组“ToList”转换为非委托类型 'System.Collections.Generic.List' 你打算 调用方法?
【问题讨论】:
-
线索在“你打算调用该方法吗?”
标签: c# linq iqueryable