public static TResult Run <TResult>(MySession session, MyWebService service, Func <TResult> function) { //Reconnect service.Connect(session.Site); service.Login(session.User, session.Pass); //Execute the webserivce call TResult result = function.Invoke(); //Disconnect service.Disconnect(); return(result); }
public static TResult Run <TResult>(MySession session, MyWebService service, ICommand <TResult> command) { //Reconnect service.Connect(session.Site); service.Login(session.User, session.Pass); //Execute the webserivce call TResult result = command.Execute(); //Disconnect service.Disconnect(); return(result); }