Type t = Type.GetType(classname)classname 是命名空间+类名
因为在不同项目之间操作,所以这样写t的值是null
应该如何操作

解决方案 »

  1.   

    先加载DLL,不加载反射谁去。
      

  2.   

    ++加载dll 之后才能去找到 它,要不然很定为null 咯
      

  3.   


    1. 如果项目引用了 项目名.dll  
     Type type = Type.GetType("命名空间.类名, 命名空间"); 就可以了。2. 如果项目没有引用 项目名.dll  
      Assembly assm = Assembly.LoadFrom("项目名.dll");
      Type type = assm.GetType("命名空间.类名");  
      
    //方法唯一,不能有多个不同参数的方法,因为多个方法,不知道错误在哪,找了一个下午= =!
    System.Reflection.MethodInfo method = type .GetMethod("方法名")