public static void Main() { // Create an instance of MyProxy. MyProxy myCustomProxy = new MyProxy(typeof(CustomServer)); // Get an instance of remote class. CustomServer myHelloServer = (CustomServer)myCustomProxy.GetTransparentProxy(); double myDoubleValue = 10.5; int myIntValue = 200; // Invoke the remote method. myHelloServer.HelloMethod("Hello", ref myDoubleValue, out myIntValue); }
public static void Main() { Console.WriteLine(""); Console.WriteLine("CustomProxy Sample"); Console.WriteLine("=================="); MyProxy mProxy = new MyProxy(typeof(WinNTSystemInfo)); WinNTSystemInfo myHelloServer = (WinNTSystemInfo)mProxy.GetTransparentProxy(); Console.WriteLine("Machine Name = " + myHelloServer.ComputerName); Console.WriteLine("Domain Name = " + myHelloServer.DomainName); Console.WriteLine("User Name = " + myHelloServer.UserName); // Construct Guid object from unmanaged Interface 'IADsWinNTSystemInfo' guid. Guid myGuid = new Guid("{6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}"); IntPtr myIntrPtr = mProxy.SupportsInterface(ref myGuid); Console.WriteLine("Requested Interface Pointer= " + myIntrPtr.ToInt32()); }
public static void Main() { // Create an instance of MyProxy. MyProxy myCustomProxy = new MyProxy(typeof(CustomServer)); // Get an instance of remote class. CustomServer myHelloServer = (CustomServer)myCustomProxy.GetTransparentProxy(); try { // Invoke remote method. myHelloServer.RaiseException(); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } }