开发者

Convert this linq code to expression

Can an expert in C# helps me to convert this linq code into Expression trees ?

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开发者_JAVA技巧 = p.Value
                                };

Thanks !


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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜