Re: invoke a method by reflection#,the method's parameters can not be ArrayList?
- From: "Erick" <notifications@xxxxxxxxxxxx>
- Date: Tue, 2 Aug 2005 10:11:26 +0000
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@xxxxxxxxx> wrote in message news:OI7p2AolFHA.3816@xxxxxxxxxxxxxxxxxxxx:
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!
.
- References:
- Prev by Date: invoke a method by reflection£¬the method's parameters can not be ArrayList?
- Next by Date: Re: invoke a method by reflection�����������������������������������������������
- Previous by thread: invoke a method by reflection£¬the method's parameters can not be ArrayList?
- Next by thread: Re: invoke a method by reflection�����������������������������������������������
- Index(es):
Relevant Pages
|
Loading