Throw in Exception handling

Posted by Fundaravi under C# on 4/13/2012 | Points: 10 | Views : 1109 | Status : [Member] | Replies : 2
Catch (Exception ex)
{
Throw ex;
Throw;
}
In the above code what is the difference between throw ex and throw

Ravindra


Responses

Posted by: Sakthi.Singaravel on: 4/13/2012 [Member] Silver | Points: 25

Up
0
Down
The empty parameter re-throw keeps the existing stack list, the parametered version creates a new stack trace to the point of the throw. For debugging, the empty version tells you where the error actually occurred, the parametered version discards that.

Regards,
Singaravel M

Fundaravi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/13/2012 [Member] Silver | Points: 25

Up
0
Down
see this link for example..

http://www.codeproject.com/Articles/20804/Difference-between

Regards,
Singaravel M

Fundaravi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response