Here is your problem, the Invoke method overload you're using takes the
target object and an array or arguments. In your case you only have one
argument which is a object array.
Change:
object temp = myType.GetMethod("Exec").Invoke(myInstance, obj);
To:
object temp = myType.GetMethod("Exec").Invoke(myInstance,new object[]{
obj});
HTH
Erick Sgarbi
www.blog.csharpbox.com
"jerry051" <bestsoft (AT) sogou (DOT) com> wrote
Quote:
I invoke a method by reflection, when this method's parameters is simple
type like int or string,the invoking is correct and secceed. But when the
parameters is ArrayList type, debuger tips me that meet
System.Reflection.TargetParameterCountException error, and parameters count
is not matching. please help me why happen this error,thanks a lot! |