Azure Blob download as byte array error "Memory Stream is not expandable" -


i want download blob byte array, above mention error occur. code follow

  dim fullfilebytes() byte = {}  dim objazurestorage new azurecloudstorage                              dim fullimageblob microsoft.windowsazure.storage.blob.cloudblockblob = objazurestorage.cloudcontainer.getblockblobreference(row(0))                              fullimageblob.downloadtobytearray(fullfilebytes, 0) 

since have not worked vb.net, let me provide answer in c#. have done read blob's contents in memory stream , converted byte array , return array.

    private static byte[] readblobinbytearray()     {         var cred = new storagecredentials(accountname, accountkey);         var account = new cloudstorageaccount(cred, true);         var container = account.createcloudblobclient().getcontainerreference("container-name");         var blob = container.getblockblobreference("blob-name");         using (var ms = new memorystream())         {             blob.downloadtostream(ms);             return ms.toarray();         }     } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -