Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
-C#- Error Handling
#5
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 }

Messages In This Thread
-C#- Error Handling - by MindHACKer - Nov 21 2011, 01:15 PM
RE: -C#- Error Handling - by M. Bison - Nov 21 2011, 10:34 PM
RE: -C#- Error Handling - by MindHACKer - Nov 22 2011, 05:31 AM
RE: -C#- Error Handling - by Helices - Nov 29 2011, 05:43 AM
RE: -C#- Error Handling - by Leaky - Nov 30 2011, 05:04 PM

Users browsing this thread: 1 Guest(s)