public static double Add(params double[] args) { try { RemoteObject proxyObject = (RemoteObject)Activator.GetObject(typeof(RemoteObject), ServiceURL + "RemoteObject"); double obj = proxyObject.Add(args); return(obj); } catch (Exception e) { throw new Exception("调用远程对象时出错:" + Environment.NewLine + e.Message); } }
public static object CallRemoteOperation(MethodInfo method, object instance, params object[] args) { try { RemoteObject proxyObject = (RemoteObject)Activator.GetObject(typeof(RemoteObject), ServiceURL + "RemoteObject"); object obj = proxyObject.Operation(method, instance, args); return(obj); } catch (Exception e) { throw new Exception("调用远程对象时出错:" + Environment.NewLine + e.Message); } }