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

Define xmlreader class.

964


Explain the difference between Repeater and Data list control in ASP.NET?

1070


What is the difference between mvc (model-view-controller) and mvp (model-view-presenter)? : asp.net mvc

992


What is the concept of postback in asp.net?

1007


Explain the difference between webfarm and webgardens in .net?

940


What is the use of worker process in asp.net?

956


What is the main function of url routing system in asp.net mvc? : asp.net mvc

964


Which asp.net objects encapsulate the state of the client and the browser?

1040


What are strong names?

987


What are the page life cycle events?

862


Why viewstate is used in asp.net?

986


Where you store Connection string in "Web.Config" file in ASP.NET?

1012


How many types of session state management options available in asp.net?

1004


How do you handle server controls?

1095


What is the life cycle of web page?

915