Stacker
Stacker

Reputation: 8237

Expression Tree Creation and ExpressionTree Convert Type

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 expression and rebuild it except for

case ExpressionType.Convert:

any idea ? thanks in advance.

Upvotes: 0

Views: 791

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1503489

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.

Upvotes: 4

Related Questions