Hi
I want to merge the catch blocks in the following code for code reuse reasons:
try
{
DoSomeInputOutput();
}
catch (InvalidOperationException ex)
{
HandleKnownException1(ex);
}
catch (InvalidDataException ex)
{
HandleKnownException1(ex);
}
catch (ArgumentNullException ex)
{
HandleKnownException1(ex);
}
catch (ArgumentOutOfRangeException ex)
{
HandleKnownException2(ex);
}
catch (ArithmeticException ex)
{
HandleKnownException2(ex);
}
catch (InvalidCastException ex)
{
HandleKnownException2(ex);
}
catch (Exception ex)
{
HandleUnknownException(ex);
}
to something like this:
try
{
DoSomeInputOutput();
}
catch (InvalidOperationException ex)
catch (InvalidDataException ex)
catch (ArgumentNullException ex)
{
HandleKnownException1(ex);
}
catch (ArgumentOutOfRangeException ex)
catch (ArithmeticException ex)
catch (InvalidCastException ex)
{
HandleKnownException2(ex);
}
catch (Exception ex)
{
HandleUnknownException(ex);
}
Is that possible somehow?
Thanks.