CSharp · Console
using System;
using static System.Console;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
try
{
FazerAlgo();
}
catch (AggregateException ae)
{
ae.Handle((ex) =>
{
WriteLine(ex.Message);
return true;
});
}
}
static void FazerAlgo()
{
throw new AggregateException("", new List<Exception>
{
new Exception("Erro 1"),
new Exception("Erro 2")
});
}
}