Can we throw exception from catch block ?
Answer Posted / arjun
The exceptions, which we caught inside a catch block, can
re-throw to a higher context by using the keyword throw
inside the catch block. The following program shows how to
do this.
//C#: Exception Handling: Handling all exceptions
using System;
class MyClass
{
public void Method()
{
try
{
int x = 0;
int sum = 100/x;
}
catch(DivideByZeroException e)
{
throw;
}
}
}
class MyClient
{
public static void Main()
{
MyClass mc = new MyClass();
try
{
mc.Method();
}
catch(Exception e)
{
Console.WriteLine("Exception caught here" );
}
Console.WriteLine("LAST STATEMENT");
}
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is page fragment caching?
What are the advantages and disadvantages of session?
What is the sequence in which ASP.NET events are processed?
What is synchronous and Asynchronous post back ?
What does asax stand for?
Explain the difference between sql invalidation and sql notification.
What are the different ways you would consider sending data across pages in ASP (i.e between asp to asp)?
What is event bubbling?
What is difference between view and partial view?
I want to connect a system in LAN and I want to access that. Whenever I am moving a mouse in my desktop, the similar thing has to happen in another system in which I have connected. I need coding for this in C# and ASP.NET Can anyone please help me. It is very urgent. Thanks in advance. My email id is manojkumarchallagundla@gmail.com Will you please?
What is the base class from which web forms are inherited?
What is ASLM?
What is a user session?
Can I stream live content/events?
Explain what does wsdl stand for?