title: Download Blob file into Memory Stream from Azure using C#
body: <p>I am trying to read a blob from Azure using C# Console application. I can download the blob file to my local machine and read it but when I am trying to download it to memory stream it is throwing an error as attached.<a href="https://i.stack.imgur.com/KDf4r.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KDf4r.jpg" alt="enter image description here" /></a></p>
  <p>I want to directly read my blob file instead of downloading it to local machine as I have to deploy it in Azure. Any suggestions on it?</p>
  <pre><code>var storageaccount = new CloudStorageAccount(new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(StorageAccountName, StorageAccountKey), true);
          var blobclient = storageaccount.CreateCloudBlobClient();
          var container = blobclient.GetContainerReference(&quot;&quot;);
         // var blobs = container.ListBlobs();
         var blockBlobReference = container.GetBlockBlobReference(sourceBlobFileName);
          using (var memorystream = new MemoryStream())
          {
              blockBlobReference.DownloadToStream(memorystream);
          }
  </code></pre>