反射动态调用类的方法

//调用的方法
string action = context.Request.Params["action"];

Assembly assembly = Assembly.GetExecutingAssembly();
Type type1 = typeof(className);

MethodInfo method = type1.GetMethod(action);
object obj = Activator.CreateInstance(type1);
 //参数
object[] nums = { context };
method.Invoke(obj, nums);
原文地址:https://www.cnblogs.com/JiangXiaoTian/p/3463580.html