The object[] objs array is indicating that the method expects three
parameters, rather than a single parameter which is an array.
You need an array that contains one array :)
object[] objs = new object[] { new object[] {"Hi", 123, DateTime.Now}};
PS. Who feeds the magpies?! My dad shoots them :P
On Fri, Jun 18, 2010 at 5:01 PM, Greg Keogh <[email protected]> wrote:
> Folks, the following skeleton code dies on the Invoke with a
> TargetParameterCountException. The code is all in the same class.
>
>
>
> MethodInfo mi = this.GetType().GetMethod("TestMethod", BindingFlags
> .Instance|BindingFlags.NonPublic);
>
> object[] objs = new object[] { "Hi", 123, DateTime.Now };
>
> mi.Invoke(this, objs);
>
>
>
> protected void TestMethod(object[] args)
>
> {
>
> }
>
>
>
> I’m stumped, so I’m going to feed the magpies and when I come back I’ll
> either have the answer or some other genius will tell me ;-)
>
>
>
> Greg
>