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...


How to throw an caught exception from cath block?

Answers were Sorted based on User's Feedback



How to throw an caught exception from cath block?..

Answer / lonesloane

try{
// code that throws exception
}
catch(Exception ex){
// Do whatever needed with exception
Console.Writeline(ex.Message);
throw; <== will re-throw the caught exception
}

Is This Answer Correct ?    3 Yes 0 No

How to throw an caught exception from cath block?..

Answer / gustav bouwer

This (as above) will re throw the exception.

catch (Exception e)
{
throw e;
}

This passes along the ORIGINAL exception so you keep your
stack trace.
catch (Exception e)
{
throw;
}

Is This Answer Correct ?    3 Yes 0 No

How to throw an caught exception from cath block?..

Answer / chandana

use the 'throw' keyword to throw an exception from a catch
block. ex,

catch (Exception e)
{
throw e;
}

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More C Sharp Interview Questions

What is a template class?

0 Answers  


What is the data provider name to connect to access database?

0 Answers  


What are the types of comments in c#?

0 Answers  


What is the difference between system.text.stringbuilder and system.string?

0 Answers  


How can we give strong name to assembly? What is satellite assembly?

2 Answers   SMNetserv,


Why hashtable is thread safe in c#?

0 Answers  


Can an exception be thrown from a catch block?

0 Answers   Alcatel-Lucent,


What is meaning of type safety in c#?

0 Answers  


What is Assembly. and Describe type of assembly. why most developer happy with private assembly.

0 Answers   MCN Solutions,


Is it possible to have different access modifiers on the get/set methods of a property?

0 Answers  


Why static constructor is parameterless in c#?

0 Answers  


Why do we use lambda expression in c#?

0 Answers  


Categories