private static ExpressionValue Create(object o) { Number n; if (Number.TryCreate(o, out n)) { return(ExpressionValue.Create(n)); } var type = o.GetType(); if (type == typeof(bool)) { return(ExpressionValue.Create((bool)o)); } throw new Exception($"Don't know how to convert {o.GetType().Name}"); }