예제 #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();
        }
예제 #2
0
파일: Program.cs 프로젝트: ErhanGDC/MyWorks
        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();
        }
예제 #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();
        }
예제 #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);
            }
        }