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 LogicalBinaryExpressionorexpression.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?
LogicalBinaryExpressionisinternal, so:Type, you can’t simply usetypeof(LogicalBinaryExpression)orx is LogicalBinaryExpression.You should either check for
BinaryExpression, or check theNodeTypeof the expression.The same applies to
MethodBinaryExpression.