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."); }
private string GetObject(MyMarshalByRefClass myMarshalByRefClassObj) { var result = "No exception"; try { var myReturnValue = myMarshalByRefClassObj.MyMethod(); } catch (Exception ex) { result = ex.ToString(); } return(result); }