【发布时间】:2012-04-26 12:40:33
【问题描述】:
我需要将 linq 查询结果转换为列表。我尝试了以下代码:
var qry = from a in obj.tbCourses
select a;
List<course> lst = new List<course>();
lst = qry.ToList();
以上代码出现如下错误:
Cannot implicitly convert type
System.Collections.Generic.List<Datalogiclayer.tbcourse> to
System.Collections.Generic.List<course>
【问题讨论】:
-
怎么没有帮助?你期望什么没有发生?
-
顺便说一句,你的代码可能会更短...
var lst = obj.tbCourses.ToList();
标签: linq