刚刚学习LINQ,我在我的测试项目中遇到了一个新手路障。你能解释我做错了什么吗?如何将IQueryable <T>转换为列表<T>?
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>;
}
我收到一个错误说以下内容:
Cannont转换方法组“ToList”非委托类型 “System.Collections.Generic.List”你打算 调用方法?
线索是 “你打算调用的方法?” – 2009-08-15 11:49:07