public async System.Threading.Tasks.Task <SoftmakeAll.SDK.OperationResult> DeleteAsync(System.String ContainerName, System.String[] StorageFileNames) { SoftmakeAll.SDK.CloudStorage.Azure.Environment.Validate(); SoftmakeAll.SDK.OperationResult OperationResult = new SoftmakeAll.SDK.OperationResult(); if ((System.String.IsNullOrWhiteSpace(ContainerName)) || (StorageFileNames == null) || (StorageFileNames.Length == 0)) { OperationResult.Message = "The ContainerName and StorageFileName cannot be null."; return(OperationResult); } try { global::Azure.Storage.Blobs.BlobContainerClient BlobContainerClient = new global::Azure.Storage.Blobs.BlobContainerClient(SoftmakeAll.SDK.CloudStorage.Azure.Environment._ConnectionString, ContainerName); using (System.Threading.SemaphoreSlim SemaphoreSlim = new System.Threading.SemaphoreSlim(StorageFileNames.Length)) { System.Collections.Generic.List <System.Threading.Tasks.Task> DeleteTasks = new System.Collections.Generic.List <System.Threading.Tasks.Task>(); foreach (System.String StorageFileName in StorageFileNames) { global::Azure.Storage.Blobs.BlobClient BlobClient = BlobContainerClient.GetBlobClient(StorageFileName); if (!(await BlobClient.ExistsAsync())) { continue; } await SemaphoreSlim.WaitAsync(); DeleteTasks.Add(System.Threading.Tasks.Task.Run(async() => { await BlobClient.DeleteAsync(); SemaphoreSlim.Release(); })); } if (DeleteTasks.Any()) { await System.Threading.Tasks.Task.WhenAll(DeleteTasks); } } } catch (System.Exception ex) { OperationResult.Message = ex.Message; return(OperationResult); } OperationResult.ExitCode = 0; return(OperationResult); }