Exemplo n.º 1
0
        public void CreateAndRaise()
        {
            Pub4 p = new Pub4();

            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 ex)
            {
                Console.WriteLine(ex.InnerExceptions.Count);
            }
        }
Exemplo n.º 2
0
        public void CreateAndRaise()
        {
            Pub4 p = new Pub4();

            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 ex)
            {
                Console.WriteLine(ex.InnerExceptions.Count);
            }
        }