public static AsyncActionWithProgress <ulong> UploadAsyncWithProgress(this Renci.SshNet.SftpClient sftpClient, Stream input, string targetPath) { return(new AsyncActionWithProgress <ulong>((callBack, state, progressCallback) => sftpClient.BeginUploadFile(input, targetPath, callBack, state, progressCallback), asyncResult => sftpClient.EndUploadFile(asyncResult), null)); }