0
这里的两个集合是我一起工作的代码:LINQ的问题查询数据
Collection<WorkOrderLabor> workOrder = new Collection<WorkOrderLabor>();
Collection<ServiceItem> serviceItems = new Collection<ServiceItem>();
serviceItems = from si in serviceItems
join cw in workOrder on si.ServiceKey equals cw.Key
select new { si };
foreach (ServiceItem item in serviceItems)
ctrl.Items.Add(...);
我收到此错误:
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<AnonymousType#1>' to 'System.Collections.ObjectModel.Collection<ServiceItem>'
我相信这是希望一个简单的办法,但我无法弄清楚。这背后的逻辑是我需要根据传递给此方法的键来查找工作订单,然后获取工单所有的服务项目并遍历它们以将它们放入组合框中。
优秀拉斯,太感谢你了! – ledgeJumper 2012-07-13 21:52:19