Ejemplo n.º 1
0
        /// <summary>
        /// Static version of the Expression Evaluator
        /// </summary>
        /// <param name="expression">expression to be evaluated</param>
        /// <param name="handler">attach a custom function handler</param>
        /// <returns></returns>
        public static object Evaluate(string expression, AdditionalFunctionEventHandler handler)
        {
            ExpressionEval expr = new ExpressionEval(expression);

            expr.AdditionalFunctionEventHandler += handler;
            return(expr.Evaluate());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This routine will replace functions existing in a input string with thier respective values
        /// </summary>
        /// <param name="input">input string</param>
        /// <param name="handler">Additional function handler for custom functions</param>
        /// <returns>input string with all found functions replaced with returned values</returns>
        public static string Replace(string input, AdditionalFunctionEventHandler handler)
        {
            FunctionEval expr = new FunctionEval(input);

            if (handler != null)
            {
                expr.AdditionalFunctionEventHandler += handler;
            }
            return(expr.Replace());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Evaluates a string expression of a function
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="handler">attach a custom function handler</param>
        /// <returns>evauluated value</returns>
        public static object Evaluate(string expression, AdditionalFunctionEventHandler handler)
        {
            FunctionEval expr = new FunctionEval(expression);

            if (handler != null)
            {
                expr.AdditionalFunctionEventHandler += handler;
            }
            return(expr.Evaluate());
        }
Ejemplo n.º 4
0
 /// <summary>
 /// This routine will replace functions existing in a input string with thier respective values
 /// </summary>
 /// <param name="input">input string</param>
 /// <param name="handler">Additional function handler for custom functions</param>
 /// <returns>input string with all found functions replaced with returned values</returns>
 public static string Replace(string input, AdditionalFunctionEventHandler handler)
 {
     FunctionEval expr = new FunctionEval(input);
     if (handler != null)
         expr.AdditionalFunctionEventHandler += handler;
     return expr.Replace();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Evaluates a string expression of a function
 /// </summary>
 /// <param name="expression"></param>
 /// <param name="handler">attach a custom function handler</param>
 /// <returns>evauluated value</returns>
 public static object Evaluate(string expression, AdditionalFunctionEventHandler handler)
 {
     FunctionEval expr = new FunctionEval(expression);
     if (handler != null)
         expr.AdditionalFunctionEventHandler += handler;
     return expr.Evaluate();
 }