I'm trying to parse Expression and at some point I have to parse expressions with type System.Linq.Expressions.LogicalBinaryExpression
. This class name I take from debug watch. expression.GetType().ToString()
equals "System.Linq.Expressions.LogicalBinaryExpression"
. But I cant see this class in System.Linq.Expressions
namespace. Nowhere at all. The same thing with MethodBinaryExpression
class.
In order to check type I really prefer to write
expression is LogicalBinaryExpression
orexpression.GetType() = typeof(LogicalBinaryExpression )
but definitely notexpression.GetType().ToString() == "System.Linq.Expressions.LogicalBinaryExpression"
So now I just have error
The type or namespace name 'LogicalBinaryExpression' does not exist in the namespace 'System.Linq.Expressions' (are you missing an assembly reference?)
How this possible?
LogicalBinaryExpression
is internal
, so:
Type
, you can't simply use typeof(LogicalBinaryExpression)
or x is LogicalBinaryExpression
.You should either check for BinaryExpression
, or check the NodeType
of the expression.
The same applies to MethodBinaryExpression
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With