vendredi 13 mars 2015

How to get a method and invoke by reflection

this is a class called "App" and there is a private method in this class



private void Application_Startup(object sender, StartupEventArgs e)
{}


in another program I want to reflect the "App" class and invoke Application_Startup method. but it is private method, how can I do ? thanks.



Assembly winForm = Assembly.LoadFile("....");
App obj = (App)winForm.CreateInstance("App");





Aucun commentaire:

Enregistrer un commentaire