Order of Operations in nested try..catch..finally
Let’s dive in and take a look at some common and not-so-common exception handling arrangements.
Everyone should be familiar with the standard try..catch..finally construct:
try { //this code will run only until an exception is thrown } catch { //this code will run only IF and exception is thrown } finally { //this code will run always AFTER the try and/or catch blocks have been executed }
Here is a less common arrangement. When might this be appropriate to use?
try { try { } catch { } } finally { }
Now let’s look at some concrete examples. Consider this code snippet:
Read More »Order of Operations in nested try..catch..finally