示例#1
0
        static void Main(string[] args)
        {
            /* IHuman h;
             * Theodore t;
             * h = new Theodore();
             * //cast for assignement
             * t = (Theodore)h;
             * //use class based reference
             * t.Name = "Fred";
             * t.Speak("I like public implementations!");
             * //use interface reference
             * h.Name = "Teddy";
             * h.Speak("I like VB!");*/


            NotifyMe d = new NotifyMe(Listener.GetNotifiedAgain);


            InvokeDelegate(d);

            Listener lsnr = new Listener();

            NotifyMe d2 = new NotifyMe(lsnr.GetNotified);

            InvokeDelegate(d2);

            InvokeDelegate(d);

            Console.Read();
        }
示例#2
0
        public ActionResult Notify(NotifyMe notifyMe)
        {
            var repo = new Repository(Properties.Settings.Default.ConStr);

            repo.AddNotify(notifyMe);
            TempData["NotifyMe"] = notifyMe;
            return(Redirect("/home/index"));
        }
        static void Main(string[] args)
        {
            NotifyMe d = new NotifyMe(Listener.GetNotifiedAgain);

            InvokeDelegate(d);
            Listener lsnr = new Listener();
            NotifyMe d2   = new NotifyMe(lsnr.GetNotified);

            InvokeDelegate(d2);
        }
示例#4
0
        static void Main(string[] args)
        {
            IHuman h; Theodore t; h = new Theodore();

            t      = (Theodore)h;
            t.Name = "Fred";
            t.Speak("I like public implementations!");
            h.Name = "Teddy";
            h.Speak("I like VB!");
            NotifyMe d = new NotifyMe(Listener.GetNotifiedAgain);

            InvokeDelegate(d);
            Listener lsnr = new Listener();
            NotifyMe d2   = new NotifyMe(lsnr.GetNotified);

            InvokeDelegate(d2);
            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)
        {
            /*IHuman h;
             * Theodore t;
             * h = new Theodore();
             * t = (Theodore)h;
             * t.Speak("I like public implementations!");
             * h.Name = "Teddy";
             * h.Speak("I like VB!");
             * Console.ReadLine();*/

            NotifyMe d = new NotifyMe(Listener.GetNotifiedAgain);

            InvokeDelegate(d);
            Listener lsnr = new Listener();
            NotifyMe d2   = new NotifyMe(lsnr.GetNotified);

            InvokeDelegate(d2);
            Console.ReadLine();
        }
示例#6
0
 static void InvokeDelegate(NotifyMe d)
 {
     d("You are late paying your bills!");
 }