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 are generic types?

0 Answers  


Distinguish between finally and finalize blocks?

0 Answers  


Why use a singleton instead of static methods?

0 Answers  


Does c# have functions?

0 Answers  


when data member or member function is static is acess specifier is considered??

2 Answers  


Is c++ or c# better?

0 Answers  


How does bitwise xor work?

0 Answers  


To catch any possible exception What is the C# syntax written ?

0 Answers   Siebel,


What is callback function in c#?

0 Answers  


What is Abstraction?

8 Answers   Google, HCL, IBM, MAHINDRA, Tech Mahindra,


Code to run exe like mspaint,autocad etc in asp.net.

2 Answers  


how to create crystal reports give one detail example(i want to view age category report) please give suitable example in my small knowledge

0 Answers  


Categories