public static void Main()
    {
        MyProxyClass myProxy = new MyProxyClass(typeof(Reverser));

        // The real proxy dynamically creates a transparent proxy.
        Reverser myReverser = (Reverser)myProxy.GetTransparentProxy();

        myReverser.SetString("Hello World!");
        Console.WriteLine("The out result is : {0}", myReverser.GetReversedString());
    }
Esempio n. 2
0
        public static void AopDemo2()
        {
            Console.WriteLine("Generate a new MyProxy.");
            MyProxyClass myProxy = new MyProxyClass(typeof(MyMarshalByRefClass));

            Console.WriteLine("Obtain the transparent proxy from myProxy.");
            MyMarshalByRefClass myMarshalByRefClassObj = (MyMarshalByRefClass)myProxy.GetTransparentProxy();

            Console.WriteLine("Calling the Proxy.");
            object myReturnValue = myMarshalByRefClassObj.MyMethod("Microsoft", 1.2, 6);

            Console.WriteLine("Sample Done.");
        }