using System.Collections.Generic;
public static void Main()
EvalManager.DefaultContext.RegisterType(typeof(MyMath));
EvalManager.DefaultContext.RegisterAlias("Math", "MyMath");
var decList = new List<decimal>() { 1m };
var values = new Dictionary<string, object>() { {"X", decList} };
Console.WriteLine(Eval.Execute<decimal>("Math.Average(X)", values));
Console.WriteLine(Eval.Execute<decimal>("Math.Average(X)", values));
public static class MyMath
public static decimal Average(IEnumerable<decimal> values)
return values.Any() ? values.Average() : 0m;