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 a resource? Provide an example from your recent project.

2 Answers   IBM, Logica CMG, Wipro,


What does immutable mean in c#?

0 Answers  


Can you have parameters for static constructors?

0 Answers  


Is string a data type in c#?

0 Answers  


C# is case sensitive, what is mean by case sensitive

3 Answers  






What are circular references?

0 Answers  


Is int a class in c#?

0 Answers  


Explain the difference between object type and dynamic type variables in c#?

0 Answers  


What?s an abstract class?

4 Answers   NIIT,


What is delegate in c# interview questions?

0 Answers  


What is mvc pattern in c#?

0 Answers  


What is the difference between const and readonly in c#.net?

0 Answers  


Categories