1
Answer

Ordered Catch

Ask a question
Steph Bassos

Steph Bassos

11y
791
1
Can't get this to run to show an ordered catch. What is wrong?


{
class Program
{
static void Main(string[] args)
{
try
{
int x = 0;
int y = 5 / x;
}
catch (ArithmeticException ex)
{ //derived
MessageBox.Show(ex.Message);
}
catch (Exception ex)
{ //base
MessageBox.Show(ex.Message);
}
}
}
}

Answers (1)
Next Recommended Forum