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 :)
D'oh! You're right. I was thinking one-dimensionally. This has fixed it:
mi.Invoke(this, new object[] { objs });
An Array
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
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 };