Is there way to catch multiple exceptions at once and without code duplication code example
Example 1: two exceptions same catch c#
try
{
// Code
}
catch (Exception ex) when (ex is ArbitraryType1 || ex is ArbitraryType2)
{
throw;
}
Example 2: c# catch two exceptions in one block
catch (Exception ex)
{
if (ex is FormatException || ex is OverflowException)
{
WebId = Guid.Empty;
return;
}
throw;
}