I have something along the lines of this:
object[] parameter = new object[1];
parameter[0] = x;
object instantiatedType =
Activator.CreateInstance(typeToInst
(tested successfully)
object instantiatedType =
Activator.CreateInstance(typeToInstantiate,
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance,
null, new object[] {parameter}, null);
There are two issues this addresses:
new object[] {parameter}
helps it handle the issue of passing an object[]
as a single parameter of method that takes a params object[]
argumentBindingFlags
helps resolve the non-public constructor(the two null
s relate to the binder; the default binder behaviour is fine for what we want)