Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            showString s1 = new showString(SayHello);
            // s1("Happy birthday!");
            showString s2 = new showString(new Session5().StartDinner);
            //  s2("Happy birthday!");
            showString s3 = new showString(Running);

//          s1 += s2;
//          s1 += s3;

            s1 += s2 += s3;
            // s2 = s2 + s3;
            // s1 = s1 + s2;

            // s1 = s1 + s2 + s3;
            // s2 = s2 + s3;
            s1("Happy birthday!");

            string     abc = "afafafa";
            showString s4  = delegate(string s)
            {
                s = "hello " + s + abc;
                Console.WriteLine(s);
            };

            s4("Nguyen van Nam");

            PhoneBook pb = new PhoneBook();

            pb.InsertPhone("Vu", "0987654321");
            Console.WriteLine("---------");
            pb.UpdatePhone("Vu", "0123456789");
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            EvenTest ev = new EvenTest();

            ev.Click += showStringProgram;
            ev.Age    = 20;
            ev.Age    = 22;

            ev.showEvent();

            //map ss with showStringProgram
            showString ss = new showString(showStringProgram);
            showString s2 = new showString(showStringPro);

            ss += s2;
            ss("Hello ss");

            ss.Invoke("Hello invoke");

            number nPlus     = new number(numberPlus);
            number nMinus    = new number(numberMinus);
            number nMultiply = new number(numberMultiply);
            number nDivide   = new number(numberDivide);

            nPlus(3, 2);
            nPlus += nMultiply;
            nPlus(5, 6);
            nPlus += nMinus += nMultiply += nDivide;
            nPlus(10, 5);

            Console.ReadLine();
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            showString ss = new showString(SayHello);
            showString s2 = new showString(SayBye);
            showString s3 = new showString(new Session5().SayAgain);

            //ss += s2;
            //ss += s3;
            ss += s2 += s3;
            ss("Quang Hoa");
            Session5 session5 = new Session5();

            session5.ShowMessage += SayHello;
            session5.ShowMessage += SayBye;

            session5.running();
        }
        public static void Main(string[] args)
        {
            showString s1 = new showString(SayHello);
            showString s2 = new showString(new Program().StartDinner);
            showString s3 = new showString(Running);
//
//            s1 += s2;
//            s1 += s3;
//            s1("Happy this!");
            string     abc = "string abcddflwjef";
            showString s4  = delegate(string s)
            {
                s = "hello " + s + abc;
                Console.WriteLine(s);
            };

            s4("Nguyen Van Nam");
        }
Exemplo n.º 5
0
        public static void Main(string[] args)
        {
            EventTest ev = new EventTest();

            ev.Click += showStringProgram;

            ev.Age = 20;
            ev.Age = 22;
            //ev.ShowEvent();

            showString ss = new showString(showStringProgram);
            showString s2 = new showString(showStringPro);

            ss += s2;
            // Cach 1
            ss("hello world");
            // Cach 2
            //ss.Invoke("world hello");

            Numeric n1 = new Numeric(Sum);
            Numeric n2 = new Numeric(Minus);
            Numeric n3 = new Numeric(Multiple);
            Numeric n4 = new Numeric(Divide);

            //n1(3, 2);

            //n1 += n3;

            //n1(5, 6);

            //n3 += n4;
            //n2 += n3;
            //n1 += n2;

            n1 += n2;
            n1 += n3;
            n1 += n4;

            n1(10, 5);
        }