[英]Convert LINQ query expression
我有以下代碼:
var attr = from a in ClsT.Current.GetValues()
from b in a.SomeMethod()
where typeof(ClsA).SomeOtherMethod(b)
select b;
如何將其轉換為 => 符號?
這將是
ClsT.Current.GetValues().SelectMany(a => a.SomeMethod())
.Where(b => typeof(ClsA).SomeOtherMethod(b));
等效代碼為:
var attr = ClsT.Current.GetValues()
.SelectMany(a => a.SomeMethod())
.Where(b => typeof(ClsA).SomeOtherMethod(b);
也許:
ClsT.Current.GetValues().SomeMethod().Where(b => typeof(ClsA).SomeOtherMethod(b))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.