Can multiple catch blocks that correspond to a single try block executed ?

try
{
///some error code
}
catch(Exception1 ex)
{
///some code
}
catch(Exception2 ex)
{
///some code
}
catch(Exception3 ex)
{
///some code
}
catch(Exception4 ex)
{
///some code
}

 Posted by Akiii on 3/3/2014 | Category: C# Interview questions | Views: 3609 | Points: 40
Answer:

No, It is not possible. Whenever there is an error, it will immediately look for the catch block assuming it is there. It cannot go back to the try block and check for the second exception.


Asked In: Some Interviews | Alert Moderator 

Comments or Responses

Login to post response