public CallInfoCacheItem(EventInfo ei)
 {
     this.Call = ei.CreateDynamicFunc();
     EI = ei;
     MI = ei.EventHandlerType.GetMethod("Invoke");
     SetParamInfo();
 }
 public CallInfoCacheItem(MethodInfo mi)
 {
     MI = mi;
     this.Call = mi.CreateDynamicFunc();
     EI = null;
     SetParamInfo();
 }
Esempio n. 3
0
    static void Main(string[] args)
    {
        DynamicFunc f = par =>
        {
            foreach (var p in par)
            {
                Console.WriteLine(p);
            }
            return(null);
        };

        f(1, 4, "Hi");
    }
Esempio n. 4
0
        static void Main(string[] args)
        {
            string surname  = "Güntner";
            string prename  = "Harald";
            string fullName = "Harald Güntner";

            // delegate
            ConvertMethod1 cm1 = DelegateExample.UppercaseString;

            // genericFunctions
            Func <string, string> cm2 = GenericFunc.LowercaseString;

            // anonymous
            Func <string, string> cm3 = delegate(string s)
            {
                return(s.GetType().ToString());
            };

            // LambdaFunctions
            Func <string, int>          cm4 = c => c.Length;
            Func <string, string, bool> cm5 = (a, b) => fullName.Equals(a + " " + b);

            Console.WriteLine(cm2(prename));
            Console.WriteLine(cm1(surname));

            Console.WriteLine(cm3(surname));
            Console.WriteLine(cm4(fullName));

            Console.WriteLine(cm5(prename, surname));
            Console.ReadKey();

            DynamicFunc f = par =>
            {
                foreach (var p in par)
                {
                    Console.Write(p + "/ ");
                }
                Console.ReadKey();
                return(null);
            };

            f(cm1(prename), cm2(surname), cm3(fullName), cm4(prename), cm5(prename, fullName));
        }
Esempio n. 5
0
 public void AddFunction(string functionName, DynamicFunc <double, double> functionDelegate)
 {
     FunctionRegistry.RegisterFunction(functionName, functionDelegate);
 }
Esempio n. 6
0
 public void AddFunction(string functionName, DynamicFunc <double, double> functionDelegate, bool isIdempotent = true)
 {
     FunctionRegistry.RegisterFunction(functionName, functionDelegate, isIdempotent, true);
 }