Is it possible to construct an expression tree in .NET 3.5 from code like
Expression expr = () => (true + new object())
? It seems to be impossible, since "A compiler-generated expression tree is always rooted in a node of type Expression", but I may be mi开发者_JS百科ssing something.
Obviously, such a tree can be constructed manually.
No it is not obvious that such a tree can be constructed manually. The expression the tree is representing is type-checked as it is being constructed. As such, what you ask is not possible and the answer is no.
精彩评论