我试图使用LINQ:LINQ:选择一个集合?
IEnumerable<String> debtors = (from expense in CurrentExpenses
where expense.WhoPaid == username
select expense.WhoOwes.AsEnumerable()).Distinct();
(username
和WhoPaid
是字符串,WhoOwes
是ICollection<String>
)
我想要做的就是一个IEnumerable
,每个expense
其中username
支付,所有欠谁的人。我不确定如何去做。这是编译器错误:
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<string>>' to 'System.Collections.Generic.IEnumerable<string>'. An explicit conversion exists (are you missing a cast?)
这是什么正确的语法?
+1非常好的答案 – Khh 2010-10-10 15:21:32