I want to be able to add more than one task. And you can get which task is completed and get the return result
Then continue to wait until all other tasks are completed. And you can add new tasks to the list at any time.
Code:
private static async Task ProcessTasksAsync(string urlA, string urlB)
        {
            var httpClient = new HttpClient();
            // start 2 or more tasks
            Task<byte[]> downloadTaskA = httpClient.GetByteArrayAsync(urlA);
            Task<byte[]> downloadTaskB = httpClient.GetByteArrayAsync(urlB);
            var tasks = new List<Task<byte[]>> { downloadTaskA, downloadTaskB };
            while (true)
            {
                // wait one task done
                Task<byte[]> completedTask = await Task.WhenAny(tasks);
                //remove finished task
                tasks.Remove(completedTask);
                if (!tasks.Any())
                {
                    break;
                }
            }
        }