Renci.SshNet.SftpClient.EndListDirectory C# (CSharp) Method

EndListDirectory() public method

Ends an asynchronous operation of retrieving list of files in remote directory.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
public EndListDirectory ( IAsyncResult asyncResult ) : IEnumerable
asyncResult IAsyncResult The pending asynchronous SFTP request.
return IEnumerable
        public IEnumerable<SftpFile> EndListDirectory(IAsyncResult asyncResult)
        {
            var ar = asyncResult as SftpListDirectoryAsyncResult;

            if (ar == null || ar.EndInvokeCalled)
                throw new ArgumentException("Either the IAsyncResult object did not come from the corresponding async method on this type, or EndExecute was called multiple times with the same IAsyncResult.");

            // Wait for operation to complete, then return result or throw exception
            return ar.EndInvoke();
        }