I'm developing an application that needs to explore all the UserControls/Forms of a library in a similar way that the Designer of Visual Studio does.
The first part is easy, as I can get all the classes with normal reflection. My problem is when trying to create a new instance, I need to pass the required parameters to the constructor in case there's no empty one.
The solution I'm looking for is to bypass in some way the constructor so I can instantiate the class and then call InitializeComponent
in that instance.
How Visual Studio's designer is able to create a new instance for a class with no empty constructor?
I've tried to create a new instance via the Assembly.CreateInstance
but if no empty constructor is found an exception is thrown.
Aucun commentaire:
Enregistrer un commentaire