lundi 12 octobre 2015

how to Invoke event in a c# dll

I Have 2 DLL.

One Like This:

namespace dll1 //dll1.dll
{
    public class AppBase
    {
        public event Action<object> Startup;
    }
}

And The Other One:

namespace dll2 //dll2.dll
{
    public class App : AppBase
    {
        public App()
        {
            Startup += App_Startup;
        }

        private void App_Startup(object obj)
        {
            //to do something.
        }
    }
}

if i want to get the result of execute code at '//to do something.',what should i write. thank for your answer.

here i wrote a few codes:

var assembly = Assembly.LoadFrom("dll2.dll")
var ttype = assembly.GetType("dll2.App");
var eventtype = ttype.GetEvent("Startup");

Then what to write...





Aucun commentaire:

Enregistrer un commentaire