Register now or log in to join your professional community.
Yes. There can be multiple catch blocks. But you have to take while creating them as the one that first matches the exception type is executed first.
Ex.
try
{
}
catch (IOException ex1)
{
// Code Block 1
}
catch (Exception ex2)
{
// Code Block 2
}
In above example if exception is IOException then Code Block 1 will be executed otherwise for other exceptions Code Block 2 will be executed.