So, I understand from this question that finally
blocks can be used to execute code even if an Exception occurs and even if the Exception is uncaught and allowed to propagate up.
I understand from this question that in C#, the throw
keyword can be used alone (with no arguments) in a catch
block to allow the caught Exception to continue propagating up without even resetting the stack trace.
My question, then, is what is the difference between THESE two blocks:
/* example 1 */
try { /* try stuff */ }
finally { /* finally/catch stuff */ }
/* example 2 */
try { /* try stuff */ }
catch { /* finally/catch stuff */ throw; }
Don't both run the stuff the try stuff
, then run the finally/catch stuff
, then allow the thrown Exception to propogate up with the same stack trace?