show more code? did you forget to inherit?if you use yourObject.GetType(), you should always get the subclass, for example, tryusing System;
using System.Reflection;public class a
{
   public virtual void call()
   {
Console.WriteLine("a::call()");
   }
}public class b : a
{
   public override void call()
   {
Console.WriteLine("b::call()");
   }
}class Test
{
static void Main()
{
b a1  = new b();
MethodInfo mi = a1.GetType().GetMethod("call");

mi.Invoke(a1,null); a a2 = new a();
mi = a2.GetType().GetMethod("call");
mi.Invoke(a2,null);
}
}

解决方案 »

  1.   

    b应该是从a继承的吧?
    b有call函数的其他overload版本或者同名的变量?就上面的程序没有问题。
      

  2.   

    看来问题应该改为:如何反射重载方法了。这里忘了写继承,实际代码中写了的。
    忘了基类中还有一个虚方法。
    重新看了一下,确定的错误信息是:
    System.Reflection.AmbiguousMatchException:发现不明确的匹配。代码如下:
    public class a
    {
       public virtual void call()
       {
       }
       public virtual void call( int b )
       {
       }
    }
    public class b:a
    {
       public override void call()
       {
       }
    }
    MethodInfo miProc = tOper.GetMethod("call",xxx);// tOper 为类b的实例
    xxx我已经试验过了BindingFlags.ExactBinding 和 BindingFlags.DeclaredOnly ,都不行
      

  3.   

    取void call():
    MethodInfo miproc = tOper.GetMethod("call", new Type[0]);取void call(int):
    MethodInfo miproc = tOper.GetMethod("call", new Type[1] { int });
      

  4.   

    MethodInfo miproc = tOper.GetMethod("call", new Type[1] { typeof(int) });