jeudi 9 novembre 2017

How to Pass Parameters to Activator.CreateInstance(string, string)

I need to create an object of a specific type.

The only clue i have on this type is a string (coming from a text file) and the assembly where i can find this object.

All the constructors of all the objects in this assembly have the same constructor signature, let's say :

public MyObject(object o)
{}

How can i pass this parameter to the constructor using Activator.CreateInstance (string assemblyName, string, className) ?





Aucun commentaire:

Enregistrer un commentaire