只是一个简单的问题..我怎么能用Linq重写这个?
var turbo =
(from t in _cat.Data
where t.Veh_ID == id && t.Engine == engine
select t.PartNum).FirstOrDefault();
我尝试过类似的东西,但卡住了!
var t = _cat.Data.where (x =>x.Veh_ID == id && x.Engine == engine).Select() // << stuck here
请帮忙谢谢
答案 0 :(得分:2)
var turbo = _cat.Data
.Where(x => x.Veh_ID == id && t.Engine == engine)
.Select(x => x.PartNum)
.FirstOrDefault()
答案 1 :(得分:2)
var turbo = _cat.Data
.Where (t => t.Veh_ID == id && t.Engine == engine)
.Select(t => t.PartNum)
.FirstOrDefault();
答案 2 :(得分:0)
你去吧
var turbo = _cat.Data.Where(t.Veh_ID == id && t.Engine == engine)
.Select(x => x.PartNumber)
.FirstOrDefault();