示例#1
0
        public static Action CreateMethod(string code, params string[] reference)
        {
            CheckCode(code);
            MethodConstruct methodC = new MethodConstruct();
            var             method  = methodC.Generator(code, reference).CreateDelegate(typeof(Action)) as Action;

            return(method);
        }
示例#2
0
        public static Func <TResult> CreateMethod <TResult>(string code, params string[] reference)
        {
            CheckCode(code);
            MethodConstruct methodC = new MethodConstruct();
            var             method  = methodC.Generator(code, reference).CreateDelegate(typeof(Func <TResult>)) as Func <TResult>;

            return(method);
        }
示例#3
0
        public static Delegate CreateMethod(string code, Type returnType, params string[] reference)
        {
            CheckCode(code);
            MethodConstruct methodC = new MethodConstruct();
            var             type    = typeof(Func <>);

            type = type.MakeGenericType(returnType);
            var method = methodC.Generator(code, returnType, reference).CreateDelegate(type);

            return(method);
        }