开发者

LINQ Query Returns List of Lists

I have a query:

from m in dc.ReportingMonths
where m.Month.Value == month
select (from k in m.KPI_Actives
        where k.DateActive.Year == year
        select (from r in dc.ReportingViews
                where r.KPIID == k.KPIID select r)
       );

Obviously, because it is nested LINQ queries - each returning an IQueryable I get a set of IQueryables as a result.

How do I write a 开发者_JAVA百科similar query that instead just returns a single flat list of ReportingViews (as the last query returns) without using foreach loops to create a new list?

Thanks!


Something like:

from m in dc.ReportingMonths where m.Month.Value == month
from k in m.KPI_Actives
where k.DateActive.Year == year
from r in dc.ReportingViews
where r.KPIID == k.KPIID
select r;

?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜