/// <summary>
        /// Lists blobs beginning with the specified prefix, which must include the container name.
        /// </summary>
        /// <param name="blobClient">The Blob service client.</param>
        /// <param name="prefix">The prefix.</param>
        private static async Task ListBlobsFromServiceClientAsync(CloudBlobClient blobClient, string prefix)
        {
            Console.WriteLine("List blobs by prefix. Prefix must include container name:");

            BlobContinuationToken continuationToken = null;
            BlobResultSegment resultSegment = null; 

            try
            {
                do
                {
                    // The prefix is required when listing blobs from the service client. The prefix must include
                    // the container name.
                    resultSegment = await blobClient.ListBlobsSegmentedAsync(prefix, continuationToken);
                    foreach (var blob in resultSegment.Results)
                    {
                        Console.WriteLine("\tBlob:" + blob.Uri);
                    }

                    Console.WriteLine();

                    // Get the continuation token.
                    continuationToken = resultSegment.ContinuationToken;

                } while (continuationToken != null);

            }
            catch (StorageException e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
                throw;
            }
        }
        public async Task CloudBlobClientListBlobsSegmentedWithPrefixAsync()
        {
            string name = "bb" + GetRandomContainerName();
            DelegatingHandlerImpl delegatingHandlerImpl = new DelegatingHandlerImpl(new DelegatingHandlerImpl());
            CloudBlobClient       blobClient            = GenerateCloudBlobClient(delegatingHandlerImpl);
            CloudBlobContainer    rootContainer         = blobClient.GetRootContainerReference();
            CloudBlobContainer    container             = blobClient.GetContainerReference(name);

            try
            {
                await rootContainer.CreateIfNotExistsAsync();

                await container.CreateAsync();

                List <string> blobNames = await CreateBlobsAsync(container, 3, BlobType.BlockBlob);

                List <string> rootBlobNames = await CreateBlobsAsync(rootContainer, 2, BlobType.BlockBlob);

                BlobResultSegment     results;
                BlobContinuationToken token = null;
                do
                {
                    results = await blobClient.ListBlobsSegmentedAsync("bb", token);

                    token = results.ContinuationToken;

                    foreach (CloudBlockBlob blob in results.Results)
                    {
                        await blob.DeleteAsync();

                        rootBlobNames.Remove(blob.Name);
                    }
                }while (token != null);
                Assert.AreEqual(0, rootBlobNames.Count);

                results = await blobClient.ListBlobsSegmentedAsync("bb", token);

                Assert.AreEqual(0, results.Results.Count());
                Assert.IsNull(results.ContinuationToken);

                results = await blobClient.ListBlobsSegmentedAsync(name, token);

                Assert.AreEqual(0, results.Results.Count());
                Assert.IsNull(results.ContinuationToken);

                token = null;
                do
                {
                    results = await blobClient.ListBlobsSegmentedAsync(name + "/", token);

                    token = results.ContinuationToken;

                    foreach (CloudBlockBlob blob in results.Results)
                    {
                        Assert.IsTrue(blobNames.Remove(blob.Name));
                    }
                }while (token != null);
                Assert.AreEqual(0, blobNames.Count);
                Assert.AreNotEqual(0, delegatingHandlerImpl.CallCount);
            }
            finally
            {
                container.DeleteIfExistsAsync().Wait();
            }
        }