Tasks rarely finish in the order you started them. Since .NET 9, `Task.WhenEach` lets you process them as they complete with `await foreach`. No `WhenAny` loop. No removing finished tasks yourself. https://learn.microsoft.com/dotnet/api/system.threading.tasks.task.wheneach
Post
One important detail: `Task.WhenEach` yields the completed tasks, not their results. Await each task inside the loop to get its result and observe exceptions. Would this replace a helper in your codebase?
0 reposts0 likes
No replies yet.