知道类名(string)A,以及类名下的方法名称)(string) a,
怎么通过反射来调用A.a()?分不够可继续加分。

解决方案 »

  1.   

    前些天刚问过,可以看看下面的链接,希望对你有帮助。http://topic.csdn.net/u/20090917/22/0c33f117-0909-4c09-8f26-dca98541ffa8.html
      

  2.   

    我的类名是一个string 字符串,你那个还需要声明类。
      

  3.   

    string name = "A";
    string method = "a";
    Type t = Type.GetType(name);
    MethodInfo m = t.GetMethod(method);
    m.Invoke(null, new Object[] {});
      

  4.   

    知道在哪个assembly里吗?
    知道的话,从这个assembly里得到这个type(通过Assembly.GetType(typeStr))
    再从这个type得到对应的MethodInfo(Type.GetMethod(methodStr))
    最后MethodInfo.Invoke()