[英]What's wrong with System.Linq.Expressions.LogicalBinaryExpression class?
I'm trying to parse Expression and at some point I have to parse expressions with type System.Linq.Expressions.LogicalBinaryExpression
. 我正在尝试解析Expression,在某些时候我必须解析类型为
System.Linq.Expressions.LogicalBinaryExpression
表达式。 This class name I take from debug watch. 我从调试手表中获取此类名。
expression.GetType().ToString()
equals "System.Linq.Expressions.LogicalBinaryExpression"
. expression.GetType().ToString()
等于"System.Linq.Expressions.LogicalBinaryExpression"
。 But I cant see this class in System.Linq.Expressions
namespace. 但是我无法在
System.Linq.Expressions
命名空间中看到这个类。 Nowhere at all. 无处可去。 The same thing with
MethodBinaryExpression
class. 与
MethodBinaryExpression
类相同的东西。
In order to check type I really prefer to write 为了检查类型我真的更喜欢写
expression is LogicalBinaryExpression
or expression is LogicalBinaryExpression
或 expression.GetType() = typeof(LogicalBinaryExpression )
but definitely not expression.GetType() = typeof(LogicalBinaryExpression )
但绝对不是 expression.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?)
名称空间'System.Linq.Expressions'中不存在类型或命名空间名称'LogicalBinaryExpression'(您是否缺少程序集引用?)
How this possible? 这怎么可能?
LogicalBinaryExpression
is internal
, so: LogicalBinaryExpression
是internal
,因此:
Type
, you can't simply use typeof(LogicalBinaryExpression)
or x is LogicalBinaryExpression
. Type
,您不能简单地使用typeof(LogicalBinaryExpression)
或x is LogicalBinaryExpression
。 You should either check for BinaryExpression
, or check the NodeType
of the expression. 您应该检查
BinaryExpression
,或检查表达式的NodeType
。
The same applies to MethodBinaryExpression
. 这同样适用于
MethodBinaryExpression
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.