BlobStorage.Advanced.ListBlobsFromServiceClient C# (CSharp) Method

ListBlobsFromServiceClient() private static method

Lists blobs beginning with the specified prefix, which must include the container name. Note that the ListBlobs method is called synchronously, for the purposes of the sample. However, in a real-world application using the async/await pattern, best practices recommend using asynchronous methods consistently.
private static ListBlobsFromServiceClient ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient, string prefix ) : void
blobClient Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient The Blob service client.
prefix string The prefix.
return void
        private static void ListBlobsFromServiceClient(CloudBlobClient blobClient, string prefix)
        {
            Console.WriteLine("List blobs by prefix. Prefix must include container name:");

            try
            {
                // The prefix is required when listing blobs from the service client. The prefix must include
                // the container name.
                foreach (var blob in  blobClient.ListBlobs(prefix, true, BlobListingDetails.None, null, null))
                {
                    Console.WriteLine("\tBlob:" + blob.Uri);
                }

                Console.WriteLine();
            }
            catch (StorageException e)
            {
                Console.WriteLine(e.Message);
                Console.ReadLine();
                throw;
            }
        }