如何构建新的表达式来测试前一个表达式的结果而不编译?

时间:2013-04-15 12:50:36

标签: c# linq expression-trees

//IsCellDataValid Method returns bool
MethodInfo isCellDataValidMethod = this.GetType().GetMethod("IsCellDataValid", BindingFlags.NonPublic | BindingFlags.Instance);

var IsCellDataValidMethodCall = Expression.Call(ruleEngineInstance, isCellDataValidMethod, new ParameterExpression[] { method params});

var cellDataValidConstantExp = ConstantExpression.IsTrue(IsCellDataValidMethodCall);

//GetCellTypeCount returns Int
var isCellDataValidExpression = Expression.IfThen(cellDataValidConstant,
                                                  GetCellTypeCountMethodCall);

现在我想将此cellTypeCountExpression的输出与用户输入的值进行比较,并且不希望编译表达式以获得结果,然后构建Constant Expression

我有类似

的东西
var resultBinaryExp = ParameterExpression.LessThan(GetCellTypeCountMethodCall, 
                               Expression.Constant(userEnteredValu), typeof(int));

0 个答案:

没有答案