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