static void Main(string[] args)
        {
            // PROTECTION PROXY
            ICar car = new CarProxy(new Driver(12)); // 22

            car.Drive();

            // PROPERTY PROXY
            var c = new Creature();

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

            // DYNAMIC PROXY FOR LOGGING
            //var ba = new BankAccount();
            var ba = Log <BankAccount> .As <IBankAccount>();

            ba.Deposit(100);
            ba.Withdraw(50);

            Console.WriteLine(ba);

            Console.ReadLine();
        }
Esempio n. 2
0
        void Main(string[] args)
        {
            ICar car = new CarProxy(new Driver(22));

            car.Drive();
        }