c# - 使用 linq 查询接收修改后的列表>
问题描述
你知道为什么这不起作用吗?
List<Tuple<DateTime, DateTime, double, double>>
newlist = from a in this.EmployeeActivityBook
where a.Item1 >= start && a.Item1 <= end
select a;
我收到此错误:
解决方案
根据您的错误,您当前正在返回 aIEnumerable<T>
而不是 a 。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();
推荐阅读
- ios - VIPER 实体和存储它们的位置
- microsoft-graph-api - 尝试使用图形 api 调用创建事件,其中 isOnlineMeeting false for MS Teams
- ios - TableViewCell 数据传输但数据迟到 iOS
- java - 服务器返回 HTTP 响应代码:带有 Dropbox API 的 URL 为 400
- javascript - 我的网页在同一浏览器中具有不同的视图,但另一台计算机具有相同的英寸
- javascript - Javacsript/CSS 在 Safari 中无法正常工作?
- reactjs - 当 yaxis 中的数据数量不等于 xaxis 中的数据数量时,在 Chartjs 2 中绘制折线图
- gitlab-ci - Gitlab 仅在上一个作业运行时才运行管道作业
- c++ - 通用特征矩阵/向量对象传输到自定义矩阵/向量容器
- javascript - 如何在反应无状态组件中的onMouseEnter div时更改图像src