can we throw execption from catchblock

Answers were Sorted based on User's Feedback



can we throw execption from catchblock..

Answer / praseetha sandeep

yes, we can throw...
catch(Exception e)
{
....
thow e
}

you can also throw new exceptin of different type
catch(IOException c)
{....
throw new FileNotFoundexception(filename)
}

we can also do like
catch(IOException c)
{
throw new FileNotFoundexception(filename,c)
}

Is This Answer Correct ?    6 Yes 0 No

can we throw execption from catchblock..

Answer / suman dey

yes we can use 'throw' or new Exception.

Is This Answer Correct ?    4 Yes 0 No

can we throw execption from catchblock..

Answer / nithya

We can throw exception in catch block

Like

try
{
int a=10/0;
}
catch(Exception ex)
{
throw ex;
}

Is This Answer Correct ?    4 Yes 0 No

can we throw execption from catchblock..

Answer / ganni

the 'try' block contains the code which may have the
runtime errors. to handle that errors we use 'catch' block.

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C Sharp Interview Questions

What is use of singleton class in c#?

0 Answers  


What is the difference between ref and out parameters in c#?

0 Answers  


what is dynamic sql

2 Answers   TCS, Wipro,


What does type safe mean in c#?

0 Answers  


What is the difference between overriding and overloading in systemverilog?

0 Answers  






Valuetype/reference type?

6 Answers   Microsoft,


Why we use get set property in c#?

0 Answers  


Why c# is called type safe language?

0 Answers  


What method is used to sort the elements of the array in descending order?

0 Answers   Siebel,


Can namespace contain the private class?

0 Answers  


What is sqlconnection in c#?

0 Answers  


Which of these statements correctly declares a two-dimensional array in c#?

0 Answers  


Categories