Throw | Throw Ex |
try{ // do some operation that can fail } catch (Exception ex) { // do some local cleanup throw; } | try { // do some operation that can fail } catch (Exception ex) { // do some local cleanup throw ex; } |
It preserve the Stack information with Exception | It Won't Send Stack information with Exception |
This is called as "Rethrow" | This is called as "Breaking the Stack" |
If want to throw new exception, throw new ApplicationException("operation failed!"); | If want to throw new exception, throw new ApplicationException("operation failed!",ex); |
Search this blog
Tuesday, June 29, 2010
Throw Vs Throw ex
Subscribe to:
Post Comments (Atom)
To learn .net, C#, Java, J2EE, Silverlight, Visual Basic, Asp .net with advanced concepts, you can visit http://advanceddotnettutorial.blogspot.com
ReplyDelete