How to determine the depth of a C# Expression Tree Iterativly?
问题 I am trying to figure out if there is a good way to figure out the depth of a particular C# Expression Tree using an iterative approach. We use expressions for some dynamic evaluation and under rare (error) conditions, the system can try to process an Expression Tree that is so large that it blows out the stack. I'm trying to figure out a way to check the depth of the tree prior to allowing the tree to be evaluated. 回答1: The ExpressionVisitor that is included in .Net is recursive, but using a