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); }
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); }
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); }