Esempio n. 1
0
        public Subscriber(string iD, Publisher pub)
        {
            this.id = iD;

            // Subscribe to the event using C# 2.0 syntax
            pub.RaiseCustomEvent += this.HandleCustomEvent;
        }
Esempio n. 2
0
        public static void Main()
        {
            Publisher pub = new Publisher();
            Subscriber sub1 = new Subscriber("Somebody", pub);

            // Call the method that raises the event.
            pub.PrintOnSecond(1);
        }