static void Main(string[] args) { ApplicationStartHandler ah = new ApplicationStartHandler(ApplicationStarted); ApplicationStartHandler ah1 = new ApplicationStartHandler(DoStuff); ApplicationStartHandler ah2 = new ApplicationStartHandler(HelloWorld); // smart ah += ah1 + ah2; ah.Invoke(Environment.MachineName); OopsApplicationStartHandler oah = new OopsApplicationStartHandler(OopsMethod); OopsApplicationStartHandler oah1 = new OopsApplicationStartHandler(OopsMethod2); OopsApplicationStartHandler oah2 = new OopsApplicationStartHandler(OopsMethod3); // Not so smart... oah += oah1 + oah2; Console.WriteLine(oah.Invoke()); // Wut did I just did ? o.O //if (oah.Target == null) //{ // Console.WriteLine(oah.Target); //} //Console.WriteLine(null); }
public static void OnApplicationStart(string str) { ApplicationStartHandler del = ApplicationStart as ApplicationStartHandler; del?.Invoke(str); }
static void Main(string[] args) { ApplicationStartHandler ap = new ApplicationStartHandler(ApplicationStarted); ap.Invoke(Environment.MachineName); }