static void DoAfterIamDead() { Delegater delegater = new Delegater(); { Owner owner = new Owner(); delegater.myDelegateFun += owner.DoSomeThingForMe; } delegater.DoingWork(); }
static void DoWhenIamLive() { Owner owner = new Owner(); Delegater delegater = new Delegater(owner.DoSomeThingForMe); delegater.EventDoThing += owner.DoSomeThingForMe; delegater.EventDoThing += delegate(string name) { Console.WriteLine("anonymous"); }; delegater.DoingWork(); }