C#的Lambda表达式嵌套例子

1 /*
2  *curStatsResult是List<string>类型,
3  *x.GetAllOsVersion()结果是string[]类型,
4  *这里是先使用SelectMany()返回一个结果,再用Count()进行统计数字
5  *而不是在SelectMany()中直接使用Count()方法
6 */
7 int amd64CountPart = curStatsResult.PartLost.SelectMany(
8 x => x.GetAllOsVersion()).Count(k=>k.Contains("NTamd64"));
View Code

 

posted @ 2016-03-09 09:55  一菲聪天  阅读(1410)  评论(0编辑  收藏  举报