假设你的方法都是Class A里面的方法 Type helloType = typeof(A) MethodInfo printMethod = helloType.GetMethod(方法名); A a = new A(); printMethod.Invoke(obj, new object[]{null}); 如果是静态方法,可以 Type helloType = typeof(A) MethodInfo printMethod = helloType.GetMethod(方法名); printMethod.Invoke(null, new object[]{null});
Type helloType = typeof(A)
MethodInfo printMethod = helloType.GetMethod(方法名);
A a = new A();
printMethod.Invoke(obj, new object[]{null});
如果是静态方法,可以
Type helloType = typeof(A)
MethodInfo printMethod = helloType.GetMethod(方法名);
printMethod.Invoke(null, new object[]{null});