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

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -