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

Hi Everyone, the design of the form disappear during writing codes for dataset and data grid. The error show in "line of assigning dataset". I don't know what's happen. If anyone know , please share of technical help from someone. Thanks, Horace Trever

1 Answers  


What is thread in c#?

0 Answers  


What is a base class in C#?

0 Answers   TryTechnicals Pvt Ltd,


When do you generally use a class over a struct?

0 Answers  


Can private virtual methods be overridden in c#.net?

0 Answers  






What namespaces are necessary to create a localized application?

1 Answers  


How do you inherit from a class in C#?

3 Answers   Visual Soft,


Can mvc be used for desktop applications?

0 Answers  


Is ram a heap?

0 Answers  


ctype(123.34,integer) - should it throw an error? Why or why not?

2 Answers   Wipro,


What is cshtml extension?

0 Answers  


What is method in c#?

0 Answers  


Categories