c# - What does "throw;" by itself do? -


possible duplicate:
difference between throw , throw new exception()

what point of having

catch (exception) {     throw; } 

what do?

by itself, throw keyword re-raises exception caught catch statement above. handy if want rudimentary exception handling (perhaps compensating action rolling transaction) , rethrow exception calling method.

this method has 1 significant advantage on catching exception in variable , throwing instance: preserves original call stack. if catch (exception ex) , throw ex, call stack start @ throw statement , lose method/line of original error.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -