C#专家可以帮助我将这个linq代码转换为表达式树吗?
var settingViewModels = from l in settingsByEnvironment["Localhost"]
from d in settingsByEnvironment["Dev"]
from p in settingsByEnvironment["Prod"]
where l.Key == d.Key && p.Key == d.Key
select new MyKeyValue
{
Key = p.Key,
LocalhostValue = l.Value,
DevValue = d.Value,
ProdValue = p.Value
};
谢谢!
答案 0 :(得分:4)
var settingViewModels = from l in settingsByEnvironment["Localhost"].AsQueryable()
from d in settingsByEnvironment["Dev"].AsQueryable()
from p in settingsByEnvironment["Prod"].AsQueryable()
where l.Key == d.Key && p.Key == d.Key
select new MyKeyValue
{
Key = p.Key,
LocalhostValue = l.Value,
DevValue = d.Value,
ProdValue = p.Value
};
var expression = settingsViewModels.Expression;