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

DoesBlobExist() public method

Whether the blob is exists or not
public DoesBlobExist ( Microsoft.WindowsAzure.Storage.Blob.CloudBlob blob, Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions options, Microsoft.WindowsAzure.Storage.OperationContext operationContext ) : bool
blob Microsoft.WindowsAzure.Storage.Blob.CloudBlob A CloudBlob object
options Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions Blob request option
operationContext Microsoft.WindowsAzure.Storage.OperationContext Operation context
return bool
        public bool DoesBlobExist(CloudBlob blob, BlobRequestOptions options, OperationContext operationContext)
        {
            CloudBlobContainer container = blob.Container;

            if (!ContainerBlobs.ContainsKey(container.Name))
            {
                return false;
            }
            else
            {
                List<CloudBlob> blobList = ContainerBlobs[container.Name];
                
                foreach (CloudBlob blobRef in blobList)
                {
                    if (blobRef.Name == blob.Name)
                    {
                        return true;
                    }
                }

                return false;
            }
        }