hucancode
0
Q:

c# multiple catch exceptions

// if C# v6+, you can use exception filters
catch (Exception ex) when (ex is FormatException || ex is OverflowException)
{
  // do something
}
2
try
{
// Code
}
catch (Exception ex) when (ex is ArbitraryType1 || ex is ArbitraryType2)
{
  throw;
}
0
catch (Exception ex)            
{                
    if (ex is FormatException || ex is OverflowException)
    {
        WebId = Guid.Empty;
        return;
    }

    throw;
}
0

New to Communities?

Join the community