Are LINQ expression trees proper trees, as in, graphs (directed or not, wikipedia does not seem too agree) without cycles? What is the root of an expression tree from the following C# expression?
(string s) => s.Length
The expression tree looks like this, with "->" denoting the name of the property of the node the other node is accessible through.
->Parameters[0]
Lambda---------Parameter(string s)
\ /
\->Body /->Expression
\ /
Member(Length)
When using ExpressionVisitor to visit the LambdaExpression, the ParameterExpression is visited twice. Is there a way to use the ExpressionVisitor to visit the LambdaExpression so that all the nodes are visited exactly once, and in a specific, well-known order (pre-order, in-order, post-order etc.)?