心灵相待吧 关注:3贴子:118
  • 0回复贴,共1

反射中Type t = Type.GetType(classname)

取消只看楼主收藏回复

反射中Type t = Type.GetType(classname),在同一个解决方案下的不同项目之间操作,classname这个命名空间+类名怎么写
1. 如果项目引用了 项目名.dll
Type type = Type.GetType("命名空间.类名, 命名空间");
2. 如果项目没有引用 项目名.dll
Assembly assm = Assembly.LoadFrom("项目名.dll");
Type type = assm.GetType("命名空间.类名");
//方法唯一,不能有多个不同参数的方法
System.Reflection.MethodInfo method = type .GetMethod("方法名")


IP属地:广东1楼2016-08-10 11:00回复