구입하기Buy
1-855-856-7678
지원Support
public IAsyncResult BeginDeleteTableIfExist ( string tableName, AsyncCallback callback, Object state )
public IAsyncResult BeginDeleteTableIfExist ( String tableName, AsyncCallback callback, Object state )
public function BeginDeleteTableIfExist ( tableName : String, callback : AsyncCallback, state : Object ) : IAsyncResult
The table name.
The callback delegate that will receive notification when the asynchronous operation completes.
A user-defined object that will be passed to the callback delegate.
The following code example deletes a table asynchronously if it exists.
public static void DeleteTableIfExistsAsync(CloudStorageAccount storageAccount)
{
// Create service client for credentialed access to the Table service.
CloudTableClient tableClient = new CloudTableClient(storageAccount.TableEndpoint.ToString(),
storageAccount.Credentials);
tableClient.BeginDeleteTable("Categories", DeleteTableIfExistsAsyncCallback, tableClient);
}
public static void DeleteTableIfExistsAsyncCallback(IAsyncResult result)
{
CloudTableClient tableClient = (CloudTableClient)result.AsyncState;
// End the operation.
if (tableClient.EndDeleteTableIfExist(result))
{
Console.WriteLine("Table deleted.");
}
else
{
Console.WriteLine("Table does not exist and so could not be deleted.");
}
}
When a table is successfully deleted, it is immediately marked for deletion and is no longer accessible to clients. The table is later removed from the Table service during garbage collection.
Note that deleting a table is likely to take at least 40 seconds to complete. If an operation is attempted against the table while it was being deleted, a StorageClientException is thrown, with additional error information indicating that the table is being deleted.