<分区>
db.opt.Select(z => new {
z.QuestionTitle,
Count = z.Responces.Where(x => x.Responseval == Constants.options.Agree).Count(),
Perc = (totresponcecount/Count)*100
}).ToList();
在上面的 lambda 中,在为例如计算百分比时我想写 (totresponcecount/Count)*100
其中 Count
已经在上面的语句中计算过了。
那么我如何访问 Count
值来写入 Perc = (totresponcecount/Count)*100
?