使用表达式树构建动态表达式 [英] Building dynamic expression using expression tree

查看:111
本文介绍了使用表达式树构建动态表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有名单。我正在尝试使用Expression Tree构建动态表达式

I have List. I am trying to build dynamic expression using Expression Tree

List<People> p;



如何使用Expression.Call实现以下表达式


How can I achieve below expression using Expression.Call

var r = p.Where(x => true && p.Count() == 2).Any() 





我尝试了什么:



我在下面尝试过链接

在Linq中动态创建子句 [ ^ ]

推荐答案

首先,您不需要 true&& ,因为它完全是多余的。 true 总是......好......所以它永远不会失败。



其次,如果你查询特定文章,然后在那里询问。每篇文章底部都有自己的论坛,并在那里发布消息提醒作者你想和他说话。在这里发帖依赖于他匆匆而过并意识到这个问题适合他。
First off, you don't need true && because it's completely redundant. true is always ... well ... true so it can never fail.

Secondly, if you have a query with a specific article, then ask about it there. Each article has its own forum at the bottom, and posting messages there alerts the author that you want to speak to him. Posting here relies on him "dropping by" and realising the question is for him.


这篇关于使用表达式树构建动态表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆