Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How asynchronous call can be implemented using delegates?

1000


What is the concept of postback in asp.net?

1044


What is the parent class of all the web server control?

950


What is inproc mode in session?

942


Will the asp.net validators run in server side or client side? How do you do client-side validation in .net?

966


How to Insert/Add in ASPXgridview

1040


How do you declare static variable?

1036


Distinguish between Server-side and Client-side code?

1095


Which is an advantage of application service providers?

900


Any disadvantages in Dataset and in reflection ?

3259


What is cached data phone?

1043


what are configuration files?

1043


How to find last error which occurred?

1039


Explain the role of global.asax?

997


What does asax stand for?

994