title: How to download Azure Blobs by referencing the file?
body: <p>I want to download files from Azure using C# then stream those into MemoryStream after that return/display to the user in Front-end with a link (Azure URI - which goes to the Azure blob) and the user will be able to see those PDF files in the browser or download them. There are multiple blobs/files in Azure so, I want to loop through each file and download to stream for example: using a foreach.</p>
  
  <p>I'm not sure how can I reference those blobs <code>CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName);</code> as here I could give a name of the specific file but I've multiple files so not sure what to go here "fileName".</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>var files = container.ListBlobs();
  
  foreach (var file in files)
  {
     using (var memoryStream = new MemoryStream())
     {
        CloudBlockBlob blockBlob = container.GetBlockBlobReference(fileName);
        blockBlob.DownloadToStream(memoryStream);
     }
  }
  </code></pre>
  
  <p>I'm not sure if I'm looping correcting right now in the code and downloading every blob?</p>
  
  <p>Also, I tried replacing <code>fileName</code> with <code>file.Uri.Segments.Last()</code> - 
  I guess which gets the name of blobs.</p>
  
  <p>The problem I'm having is that this foreach is just getting me one PDF file whenever I try to use the links in front-end. So, I need to know how can I properly loop through each file and download them?</p>