九溪

溪水润知林,滴露启慧心

用户工具

站点工具


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