比如我建立了一个admin公共类文件,里面有proc1函数,如何使用反射Assembly,当我输入admin的时候就回提示出proc1这个函数。
如果可以的话,给一个例子我吧!surging2@qq.com,反射主要用在什么地方呀?
2 回答
ibeautiful
TA贡献1993条经验 获得超5个赞
System.Reflection.Assembly ass; Type type ; object obj; ass = System.Reflection.Assembly.LoadFile(@"d:\TestReflect.dll"); type = ass.GetType("Webtest.ReflectTest");//必须使用名称空间+类名称 System.Reflection.MethodInfo method = type.GetMethods();//方法的名称
这样就可以得到了,你可以用admin
type = ass.GetType("Webtest.ReflectTest");替换掉这个字符串
- 2 回答
- 0 关注
- 341 浏览
添加回答
举报
0/150
提交
取消