Microsoft.WindowsAzure.Commands.Storage.Test.Service.MockStorageBlobManagement.DeleteCloudBlob C# (CSharp) Method

DeleteCloudBlob() public method

Delete azure blob
public DeleteCloudBlob ( Microsoft.WindowsAzure.Storage.Blob.CloudBlob blob, DeleteSnapshotsOption deleteSnapshotsOption, Microsoft.WindowsAzure.Storage.AccessCondition accessCondition, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options, Microsoft.WindowsAzure.Storage.OperationContext operationContext ) : void
blob Microsoft.WindowsAzure.Storage.Blob.CloudBlob Cloudblob object
deleteSnapshotsOption DeleteSnapshotsOption Delete snapshots option
accessCondition Microsoft.WindowsAzure.Storage.AccessCondition Access condition
options Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions
operationContext Microsoft.WindowsAzure.Storage.OperationContext Operation context
return void
        public void DeleteCloudBlob(CloudBlob blob, DeleteSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
        {
            CloudBlobContainer container = blob.Container;

            if (!this.DoesContainerExist(container, null, null))
            {
                throw new StorageException(ContainerNotFound);
            }
            else if (ContainerBlobs.ContainsKey(container.Name))
            {
                List<CloudBlob> blobList = ContainerBlobs[container.Name];
                
                foreach (CloudBlob blobRef in blobList)
                {
                    if (blobRef.Name == blob.Name)
                    {
                        blobList.Remove(blobRef);
                        return;
                    }
                }
            }

            throw new StorageException(BlobNotFound);
        }