I have something along the lines of this:
object[] parameter = new object[1];
parameter[0] = x;
object instantiatedType =
Activator.CreateInstance(typeToInstantiate, parameter);
and
internal class xxx : ICompare<Type>
{
private object[] x;
# region Constructors
internal xxx(object[] x)
{
this.x = x;
}
internal xxx()
{
}
...
}
And I get:
threw exception: System.MissingMethodException: Constructor on type 'xxxx.xxx' not found..
Any ideas?
parameter
to be the thing you passed asx
. However, I just realised that's probably not what you meant and, looking at the other answers, it seems I'm not alone. If this is correct, I suggest renamingparameter
toparameters
. Or better still, dispense withparameter
altogether:Activator.CreateInstance(typeToInstantiate, new object[]{x})
. – Elixir