标签:type from rom odi nbsp color 心态 dna create
public void Test1() { string ClassName="Person"; string MethodName="Test1"; //得到程序集对象 Assembly assObj = Assembly.LoadFrom(@"E:\反射.exe"); //得到Type对象 Type typObj = assObj.GetType("反射." + "Person"); //创建对象 object obj = Activator.CreateInstance(typObj); //得到方法 MethodInfo me = typObj.GetMethod(MethodName); //调用无参方法 me.Invoke(obj, null); }
动态调用,确实有点看不懂,心态有点崩, 又是Assembly类,还有Type类,干嘛呢。
标签:type from rom odi nbsp color 心态 dna create
原文地址:https://www.cnblogs.com/Optimism/p/10479150.html