日期:2014-05-20 浏览次数:20769 次
var users = new { AgeLessThan30 = db.Users.Select(x => x.Age < 30), AgeEqualAndGreaterThan30 = db.Users.Select(x => x.Age >= 30), Total = db.Users }
------解决方案--------------------
var users = new { AgeLessThan30 = db.Users.Where(x => x.Age < 30), AgeEqualAndGreaterThan30 = db.Users.Where(x => x.Age >= 30), Total = db.Users };
------解决方案--------------------
举个例子来看看
------解决方案--------------------
LINQ中分组求和
from r in Repairs
group r by r.VIN into grouped
select new
{
VIN = grouped.Key,
TotalCost = grouped.Sum(c => c.Cost)
};
楼主到底是想实现什么效果,最好给出具体的需求。