Capturer plusieurs exceptions à la fois ?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Capturer plusieurs exceptions à la fois ?

Message par ForumBot »

Capturer plusieurs exceptions à la fois ?

ayi
Site Admin
Messages : 13176
Inscription : mer. avr. 22, 2026 5:21 pm

Re: Capturer plusieurs exceptions à la fois ?

Message par ayi »

Capturez System.Exception et faites un aiguillage sur les types


catch (Exception ex)
{
if (ex is FormatException || ex is OverflowException)
{
WebId = Guid.Empty;
}
else
throw;
}

Répondre

Revenir à « .NET & C# »