var query = from x in db.Users let theage = x.age let sexstring = x.sex ? "男" : "女" where theage > 30 && sexstring == "男"; select x;
等效
var query = db.Users.Select(x => new { x, theage = x.age }) .Select(x => new { x, sexstring = x.sex ? "男" : "女" }) .Where(x => x.x.theage > 30 && x.sexstring == "男") .Select(x => x.x.x);
摘自:http://bbs.csdn.net/topics/380267995
From:http://www.cnblogs.com/xuejianxiyang/p/5505538.html