Пример #1
0
        static void DoAfterIamDead()
        {
            Delegater delegater = new Delegater();

            {
                Owner owner = new Owner();
                delegater.myDelegateFun += owner.DoSomeThingForMe;
            }
            delegater.DoingWork();
        }
Пример #2
0
        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();
        }