Answers for "c# multiple catch exceptions"

C#
2

c# multiple catch exceptions

// if C# v6+, you can use exception filters
catch (Exception ex) when (ex is FormatException || ex is OverflowException)
{
  // do something
}
Posted by: Guest on March-24-2020
0

c# catch two exceptions in one block

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

    throw;
}
Posted by: Guest on January-23-2020

Code answers related to "c# multiple catch exceptions"

C# Answers by Framework

Browse Popular Code Answers by Language