differnece b/w Throw; and Throw ex ; where ex is Expection Object

  • Thread starter Thread starter deepak
  • Start date Start date
D

deepak

the code goes some thing like this

try
{
some statements;
}
catch(Exception ex)
{
throw;
}

try
{
some statements;
}
catch(Exception ex)
{
throw ex;
}
 
To add to Mattias' statments with some general guidelines.

First, do not catch to simply throw. If you cannot do anything with the
exception, let it pass up the stack. You do have to catch before UI, to
avoid showing the user the error, but if you are not doing something with
the exception or attempting to fix it, try ... finally is a better pattern.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 
Back
Top