Example #1
0
        static void Main(string[] args)
        {
            //Protection Proxy
            ICar car = new CarProxy(new Driver(12)); // 22

            car.Drive();
        }
        static void Main(string[] args)
        {
            // protection proxy
            var driver1 = new Driver(12);
            var proxy1  = new CarProxy(driver1);

            proxy1.Drive();

            var driver2 = new Driver(22);
            var proxy2  = new CarProxy(driver2);

            proxy2.Drive();
            WriteLine();

            // property proxy
            var c = new Creature();

            c.Agility = 10; // c.set_Agility(10) xxxxxxxxxxxxx
                            // c.Agility = new Property<int>(10)
            c.Agility = 10;
            WriteLine();

            // dynamic proxy
            //var ba = new BankAccount();
            var ba = Log <BankAccount> .As <IBankAccount>();

            ba.Deposit(100);
            ba.Withdraw(50);
            WriteLine(ba);
            WriteLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            var  driver   = new Driver(17);
            ICar carProxy = new CarProxy(driver);

            carProxy.Drive();
        }
Example #4
0
        static void Main(string[] args)
        {
            ICar car = new CarProxy(new Driver(16));

            car.DriveCar();

            car = new CarProxy(new Driver(25));
            car.DriveCar();

            Console.ReadKey();
        }
Example #5
0
        public static void Main(string[] args)
        {
            ICar carProxy = new CarProxy(new Driver(22));

            carProxy.Drive();
        }
Example #6
0
        private static void ProtectionProxyExample()
        {
            ICar car = new CarProxy(new Driver(12));

            car.Drive();
        }
Example #7
0
        static void Main()
        {
            ICar car = new CarProxy(new Driver(12)); // 22

            car.Drive();
        }