How to check the type of a Parameter in an Expression Tree (similar to 'is' keyword)

Posted by Callum Rogers on Stack Overflow See other posts from Stack Overflow or by Callum Rogers
Published on 2010-06-08T22:43:20Z Indexed on 2010/06/08 23:42 UTC
Read the original article Hit count: 248

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about expression-trees