Пример #1
0
        static Func <object, object> CreateScriptFunction(string argName1, string expression, IScriptEngineFactory factory, bool addReturnStatement)
        {
            ScriptFunction function  = new ScriptFunction(factory, new string[] { argName1 }, expression, addReturnStatement);
            Marshaler      marshaler = new Marshaler(factory.GetScriptEngine());

            return((a) => function.Evaluate(new object[] { a }, marshaler));
        }
Пример #2
0
        public static Func <object, object, object> CreateScriptFunction(string argName1, string argName2, string expression)
        {
            ScriptEngineFactory factory = new ScriptEngineFactory();

            ScriptFunction function  = new ScriptFunction(factory, new string[] { argName1, argName2 }, expression);
            Marshaler      marshaler = new Marshaler(factory.GetScriptEngine());

            return((a, b) => function.Evaluate(new object[] { a, b }, marshaler));
        }