public static void Main()
NCalc.Expression.CacheEnabled = false;
NCalc.Expression nCalcExpression = new NCalc.Expression("SubUpper(1, 4, 'to upper')");
nCalcExpression.EvaluateFunction += delegate (string name, FunctionArgs args)
var parameters = args.EvaluateParameters();
Console.WriteLine(string.Format("Calling {0} with {1} args. {2}", name, parameters.Length, string.Join(",", parameters)));
var x = (string)parameters[2];
args.Result = x.Substring((int)parameters[0], (int)parameters[1]).ToUpper();
var result = nCalcExpression.Evaluate();
Console.WriteLine("Result is " + result);