public Expression<Func<double[], int>> Create()
{
inputs = Expression.Parameter(typeof(double[]), "input");
label = Expression.Label(typeof(int), "return");
var rootExpression = create(tree.Root);
ConstructorInfo ex = typeof(ArgumentException).GetConstructor(
new[] { typeof(string), typeof(string) });
BlockExpression block = Expression.Block(typeof(int),
rootExpression,
Expression.Throw(Expression.New(ex,
Expression.Constant("Input contains a value outside of expected ranges."),
Expression.Constant("input"))),
Expression.Label(label, Expression.Constant(0))
);
return Expression.Lambda<Func<double[], int>>(block, inputs);
}