Handle Exceptions with Task.WhenAll()

var tasks = Enumerable.Range(0, 10).Select(async _ => await Task.Delay(1000));
var whenAll = Task.WhenAll(tasks);
try
{
  await whenAll;
}
catch {}
if (whenAll.Exception is AggregateException ex)
{
  //Handle Exception
}
  

https://www.youtube.com/watch?v=s_NrqRI7Gnc&t=321s


Revision #1
Created 2025-07-20 15:29:07 UTC by Admin
Updated 2025-07-20 15:32:53 UTC by Admin