Esempio n. 1
0
        public void CreateAndRaise()
        {
            Pub p = new Pub();

            p.OnChange += () => Console.WriteLine("Eventraised to method 1");
            p.OnChange += () => Console.WriteLine("Eventraised to method 2");
            p.Raise();
        }
Esempio n. 2
0
        public static void CreateAndRaise()
        {
            Pub pop = new Pub();
            pop.OnChanged += () => Console.WriteLine("Event raised to method 1");
            pop.OnChanged += () => Console.WriteLine("Event raised to method 2");
            pop.Raise();

            Console.ReadLine();
        }
Esempio n. 3
0
        public static void CreateAndRaise()
        {
            Pub pop = new Pub();

            pop.OnChanged += () => Console.WriteLine("Event raised to method 1");
            pop.OnChanged += () => Console.WriteLine("Event raised to method 2");
            pop.Raise();

            Console.ReadLine();
        }
Esempio n. 4
0
        public static void CreateAndRaise()
        {
            Pub p = new Pub();

            p.OnChange += (sender, e) => Console.WriteLine("Subscriber 1 called");
            p.OnChange += (sender, e) => throw new Exception();
            p.OnChange += (sender, e) => Console.WriteLine("Subscriber 3 called");

            try
            {
                p.Raise();
            }
            catch (AggregateException ae)
            {
                Console.WriteLine(ae.InnerExceptions.Count);
            }
        }