How do I create empty array of a type given by reflection? I have tried using the Activator.CreateInstance(Type) method:
Type arrayType = typeof(string[]);
Activator.CreateInstance(arrayType);
but I get a MissingMethodException exception:
System.MissingMethodException: No parameterless constructor defined for this object.
What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire