public void Decoratot()
        {
            // 可參考PaymentController SetPayDataStatusToPayment
            var person = new Person("小菜");

            Console.WriteLine($"第一種裝扮");
            var pqx = new Sneakers();
            var kk  = new Trousers();
            var dtx = new TShirts();

            pqx.Decorate(person);
            kk.Decorate(pqx);
            dtx.Decorate(kk);
            dtx.Show();

            Console.WriteLine($"第二種裝扮");
            var px = new LeatherShoes();
            var ld = new Tie();
            var xz = new BusinessSuit();

            px.Decorate(person);
            ld.Decorate(px);
            xz.Decorate(ld);
            xz.Show();
        }
        public void Decoratot()
        {
            var person = new Person("小菜");

            // 第一種裝扮
            var pqx = new Sneakers();
            var kk  = new Trousers();
            var dtx = new TShirts();

            pqx.Decorate(person);
            kk.Decorate(pqx);
            dtx.Decorate(kk);
            dtx.Show();
        }
Beispiel #3
0
        /// <summary>
        /// 装饰模式
        /// </summary>
        static void TestDecorator()
        {
            Person xiaocai = new Person("xiaocai");

            Console.WriteLine("\n第一种装扮:");

            Sneakers   sneaker    = new Sneakers();
            BigTrouser bigTrouser = new BigTrouser();
            TShirts    shirts     = new TShirts();

            sneaker.Decorate(xiaocai);
            bigTrouser.Decorate(sneaker);
            shirts.Decorate(bigTrouser);
            shirts.Show();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Person Tony = new Person("Tony");

            Console.WriteLine("\n第一種裝扮:");
            Finery dtx = new TShirts();
            Finery kk = new BigTrouser();
            Finery pqx = new Sneakers();

            pqx.Decorate(Tony);
            kk.Decorate(pqx);
            dtx.Decorate(kk);
            dtx.Show();

            Console.Read();
        }
Beispiel #5
0
    static void Main(string[] args)
    {
        Person xc = new Person("小菜");

        Console.WriteLine("\n第一种装扮:");

        Sneakers   pqx = new Sneakers();
        BigTrouser kk  = new BigTrouser();
        TShirts    dtx = new TShirts();

        // 一层层嵌套、后进先出
        pqx.Decorate(xc);
        kk.Decorate(pqx);
        dtx.Decorate(kk);
        dtx.Show();
        // 大T恤 垮裤 破球鞋 装扮的小菜

        Console.WriteLine("\n第二种装扮:");

        LeatherShoes px = new LeatherShoes();
        Tie          ld = new Tie();
        Suit         xz = new Suit();

        // 一层层嵌套、后进先出
        px.Decorate(xc);
        ld.Decorate(px);
        xz.Decorate(ld);
        xz.Show();

        Console.WriteLine("\n第三种装扮:");
        Sneakers     pqx2 = new Sneakers();
        LeatherShoes px2  = new LeatherShoes();
        BigTrouser   kk2  = new BigTrouser();
        Tie          ld2  = new Tie();

        // 一层层嵌套、后进先出
        pqx2.Decorate(xc);
        px2.Decorate(pqx);
        kk2.Decorate(px2);
        ld2.Decorate(kk2);

        ld2.Show();
        // 领带 垮裤 皮鞋 破球鞋 装扮的小菜

        Console.Read();
    }
Beispiel #6
0
        public void Run()
        {
            Person person = new Person("骚货在");

            TShirts      tshirts = new TShirts();
            BigTrouser   trouser = new BigTrouser();
            LeatherShoes shoes   = new LeatherShoes();
            Suit         suit    = new Suit();
            Sneakers     sneaker = new Sneakers();
            Tie          tie     = new Tie();

            tshirts.Decorate(person);
            trouser.Decorate(tshirts);
            shoes.Decorate(trouser);
            suit.Decorate(shoes);
            sneaker.Decorate(suit);
            tie.Decorate(sneaker);

            tie.Show();
        }
        static void Main(string[] args)
        {
            Person xc = new Person("小菜");

            Console.WriteLine(Environment.NewLine + "第一种装扮:");

            Sneakers   pqx = new Sneakers();
            BigTrouser kk  = new BigTrouser();
            TShirts    dtx = new TShirts();

            pqx.Decorate(xc);
            kk.Decorate(pqx);
            dtx.Decorate(kk);
            dtx.Show();

            Console.WriteLine(Environment.NewLine + "第二种装扮:");

            LeatherShoes px = new LeatherShoes();
            Tie          ld = new Tie();
            Suit         xz = new Suit();

            px.Decorate(xc);
            ld.Decorate(px);
            xz.Decorate(ld);
            xz.Show();

            Console.WriteLine(Environment.NewLine + "第三种装扮:");

            Sneakers     pqx2 = new Sneakers();
            LeatherShoes px2  = new LeatherShoes();
            BigTrouser   kk2  = new BigTrouser();
            Tie          ld2  = new Tie();

            pqx2.Decorate(xc);
            px2.Decorate(pqx2);
            kk2.Decorate(px2);
            ld2.Decorate(kk2);
            ld2.Show();

            Console.ReadKey(true);
        }