Ends a call to BeginDirectoryExists
Namespace: System.Net.FtpClient
Assembly: System.Net.FtpClient (in System.Net.FtpClient.dll) Version: 1.0.5064.17461
Syntax
C# |
---|
public bool EndDirectoryExists(
IAsyncResult ar
) |
Visual Basic |
---|
Public Function EndDirectoryExists (
ar As IAsyncResult
) As Boolean |
Visual C++ |
---|
public:
virtual bool EndDirectoryExists(
IAsyncResult^ ar
) sealed |
Return Value
Type:
BooleanTrue if the directory exists. False otherwise.
Implements
IFtpClient..::..EndDirectoryExists(IAsyncResult)
Examples
C# |
Copy
|
using System;
using System.Net;
using System.Net.FtpClient;
using System.Threading;
namespace Examples {
public static class BeginDirectoryExistsExample {
static ManualResetEvent m_reset = new ManualResetEvent(false);
public static void BeginDirectoryExists() {
using (FtpClient conn = new FtpClient()) {
m_reset.Reset();
conn.Host = "localhost";
conn.Credentials = new NetworkCredential("ftptest", "ftptest");
conn.BeginDirectoryExists("/path/to/directory", new AsyncCallback(DirectoryExistsCallback), conn);
m_reset.WaitOne();
conn.Disconnect();
}
}
static void DirectoryExistsCallback(IAsyncResult ar) {
FtpClient conn = ar.AsyncState as FtpClient;
try {
if (conn == null)
throw new InvalidOperationException("The FtpControlConnection object is null!");
Console.WriteLine("Directory Exiss: {0}", conn.EndDirectoryExists(ar));
}
catch (Exception ex) {
Console.WriteLine(ex.ToString());
}
finally {
m_reset.Set();
}
}
}
}
|
See Also