No ITs not possible can you please check this link for brief explanation
Interviews12 answers
Can multiple catch blocks be executed?
12 Answers
ramila rajPosted Nov 7, 2019, 7:16 PM EST
Yes its possible..can you please check this url (it has an example for it)
ramila rajPosted Nov 7, 2019, 7:13 PM EST
yes multiple catch is possible in c#
Ananth GPosted Oct 21, 2016, 12:02 AM EDT
No.Catch block that handles the exception will get executed and all other catch will be skipped and then control goes to finally block if there is any and then to subsequent code after the finally block.
class A
{
static void Main(string[] args)
{
try
{
int a = 10;
int b = 0;
int i = a / b;
}
catch (DivideByZeroException)
{
Console.WriteLine("Inside Specialized Catch");
}
catch (Exception)
{
Console.WriteLine("Inside Generalized Catch");
}
finally
{
Console.WriteLine("Inside Finally");
}
Console.WriteLine("Outside try/catch/finally --- I got chance to Run");
}
}
Sachin KumarPosted Nov 19, 2015, 9:55 PM EST
yes we have multiple catch block . just type in google "can we have multiple catch for a single try in c# " you found out your answer
suraj ghosiPosted Sep 25, 2015, 11:42 AM EDT
No
Pramod VermaPosted Jan 27, 2015, 2:31 AM EST
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit PowarPosted Apr 22, 2014, 9:55 AM EDT
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit PowarPosted Apr 22, 2014, 9:55 AM EDT
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit PowarPosted Apr 22, 2014, 9:54 AM EDT
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit PowarPosted Apr 22, 2014, 9:53 AM EDT
Never when one catch block is executed, controls skip all other catch blocks and goes to finally block.
Ranjit PowarPosted Apr 22, 2014, 9:53 AM EDT
No, Multiple catch blocks can't be executed. Once the proper catch code executed, the control is transferred to the finally block and then the code that follows the finally block gets executed.
Gautam KumarPosted Nov 19, 2013, 1:47 AM EST



