tags:

views:

644

answers:

2

Are the following code snippets essentially equivalent?

catch(Exception E) {
  ...
  throw E;  //Explicitly rethrow the exception
}

and

catch(Exception E) {
  ...
  throw;    //Implicitly rethrow the exception
}

Duplicate of this question.

+4  A: 

See this question

Ray
+2  A: 

NO.

catch(Exception E) 
{
  ...
  throw E;  //Explicitly rethrow the exception
}

This one restarts the stack trace, while throw keeps the stack trace and adds to it.

IF you are going to rethrow the exception use throw.

David Basarab