使用linq查询接收修改后的List <tuple <>&gt;

时间:2018-06-12 03:12:26

标签: c# linq

你知道为什么这不起作用吗?

List<Tuple<DateTime, DateTime, double, double>> 
   newlist = from a in this.EmployeeActivityBook
             where a.Item1 >= start && a.Item1 <= end
             select a;

我收到此错误:

The error

1 个答案:

答案 0 :(得分:0)

根据您的错误,您目前正在返回IEnumerable<T>而不是List<T>

您只需在查询中致电.ToList()

List<Tuple<DateTime,DateTime,double,double>> newlist = 
    (from a in this.EmployeeActivityBook
     where a.Item1 >= start && a.Item1 <= end
     select a).ToList();