wiki:csharp:base-reflect
反射
string str = "FD3DS.Forms.frmObjVisibleControl"; Type type = Type.GetType(str); //构造 System.Reflection.ConstructorInfo construct = type.GetConstructor(new Type[] {}); Object obj = construct.Invoke(new Object[] {}); //方法 System.Reflection.MethodInfo MI_Settest = type.GetMethod("SetTest", new Type[] { typeof(string) }); Object obj1 = MI_Settest.Invoke(obj, new Object[] { "helloworld" });
wiki/csharp/base-reflect.txt · 最后更改: 2023/01/03 15:25 由 127.0.0.1
评论