Nov 30 2011, 05:04 PM
Helices Wrote:To farther add onto MindHackers post, don't forget you can re-throw exceptions through catch:
Code:catch (Exception ex)
{
throw (ex);
}
Also, don't forget it is also possible to use more than one catch clause with a try-catch statement! (right out of MSDN). There is no limitation there!
you would use multiple catch clauses to catch different types of exceptions.
Code:
try { }
catch (exception1 ex) { }
catch (exception2 ex) { }
catch (Exception ex) { this is your catch all exception incase the exception doesn't match the previous ones }
finally { this executes after the try/catch block, no matter what }