【发布时间】:2012-02-18 23:34:25
【问题描述】:
有没有办法将 2 个 linq 表达式合并为一个? IE。所以一个 LINQ 表达式会将 DistCount 和 NormCount 都返回到 2 个单独的 int 变量中。
DistCount = (from string row in myList[i]
where row.Length > 0
select row).Distinct().Count();
NormCount = (from string row in myList[i]
where row.Length > 0
select row).Count();
【问题讨论】:
-
var final = new {DistCount=1,NormCount=2};