ColinOL

A Small Website

用户工具

站点工具


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 · 最后更改: 2018/02/03 20:42 (外部编辑)