How to check the type of a Parameter in an Expression Tree (similar to 'is' keyword)
- by Callum Rogers
How do I check the type of a Parameter in an Expression Tree (and get the Expression Tree equivalent of a bool if it the right type)? If it were normal code, I would do this:
if(myObj is int)
I see there is a Expression.Convert method but this converts the object instead of just checking its type.
EDIT: I found the answer, you use a Expression.TypeIs