开发者

Expression Tree Creation and ExpressionTree Convert Type

开发者 https://www.devze.com 2023-01-16 10:30 出处:网络
lets say i have : anything.where(x=>x.age == int.parse(txtage.text)); now i know that int.parse(txtage.text) is an expression of type ExpressionType.Convert

lets say i have :

anything.where(x=>x.age == int.parse(txtage.text));

now i know that int.parse(txtage.text) is an expression of type ExpressionType.Convert

now i wanna know how to create an expression of type ExpressionType.Convert manually (programatically)

why ?

because im passing expressions between layers and changing the type of it , i managed make a visit to every exp开发者_JS百科ression and rebuild it except for

case ExpressionType.Convert:

any idea ? thanks in advance.


No, int.Parse(txtage.text) is a method call, not a conversion expression. You'd build it using Expression.Call.

However, if you do want to build a conversion expression, use Expression.Convert.

0

精彩评论

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