AzurelensBlob.BlobManager.DownloadImageAsync C# (CSharp) Метод

DownloadImageAsync() публичный статический Метод

public static DownloadImageAsync ( string ImageName ) : Task
ImageName string
Результат Task
        public static async Task<MemoryStream> DownloadImageAsync(string ImageName)
        {
            // Retrieve storage account information from connection string
            CloudStorageAccount storageAccount = CreateStorageAccountFromConnectionString(CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // Create a blob client for interacting with the blob service.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            // get container for organizing blobs within the storage account.
            Log.LogInformation("Load container: {0}", PRIVATE_CONTAINER_NAME);
            CloudBlobContainer container = blobClient.GetContainerReference(PRIVATE_CONTAINER_NAME);

            // Get a reference to the blob block
            Log.LogInformation("Load blobblock: {0}", ImageName);
            CloudBlockBlob blockBlob = container.GetBlockBlobReference(ImageName);

            // Download the file stream
            MemoryStream FileToDownload = new MemoryStream();
            Log.LogInformation("Download blobblock: {0}", ImageName);

            await blockBlob.DownloadToStreamAsync(FileToDownload);

            return FileToDownload;
        }