Building Expression Evaluator with Expression Trees in C# – Improving

added by mcnamaragio
4/23/2012 9:45:38 AM


Our expression evaluator has support for variables but it has a big disadvantage: values of the variables are bound by position and not by name. This means that you should pass values for the variables in the same order as they appear in the expression. On the other hand binding by name has following advantages: If you change the expression you do not have to worry about keeping order of the variables you pass in sync. In this post we are going to change expression evaluator to bind parameters by name. We will also add a new overload for better performance when we need to evaluate same expression with different parameter values.