C#根据函数名称执行对应的函数
1 using System; 2 using System.Collections.Generic; 3 using System.Reflection; 4 5 namespace test 6 { 7 public class test 8 { 9 public static void RunSchedule() 10 { 11 test type = Activator.CreateInstance(typeof(test), true) as test; 12 13 MethodInfo method = type.GetType().GetMethod("f1"); 14 method.Invoke(type, null); 15 } 16 private void f1() 17 { 18 19 } 20 private void f2() 21 { 22 23 } 24 } 25 }