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

Define a class and an object?

0 Answers  


What is callback delegate in c#?

0 Answers  


What is arraylist?

0 Answers  


How to Show Message box in Metro Style App?

0 Answers   PUCIT,


How can I process command-line arguments?

0 Answers  






Explain polymorphism in c# with a simple example?

0 Answers  


Explain the difference between private and shared assembly?

0 Answers  


How do you implement thread synchronization (object.wait, notify,and criticalsection) in c#?

0 Answers  


give an example for suspending, resuming, and stopping a thread ?

1 Answers   GCI,


From which base class do all Web Forms inherit from?

0 Answers   Siebel,


How big is a 64 bit integer?

0 Answers  


If we inherit a class do the private variables also get inherited ?

2 Answers   TCS,


Categories