-C#- Error Handling - Printable Version +- (wL) Forums (https://war-lords.net/forum) +-- Forum: Resources (https://war-lords.net/forum/forum-31.html) +--- Forum: Programming (https://war-lords.net/forum/forum-33.html) +--- Thread: -C#- Error Handling (/thread-5047.html) |
-C#- Error Handling - MindHACKer - Nov 21 2011 If we want to make our program more powerful and stylish, we need to stop it from crashing on Overflows & Errors, so we use this code to prevent it from crashing, & instead reporting the Error or the cause.. We use these two Methods like this: Code: try RE: -C#- Error Handling - M. Bison - Nov 21 2011 Why don't you simply think ahead and prevent the overflows and errors from ever having occurred to begin with? RE: -C#- Error Handling - MindHACKer - Nov 22 2011 M. Bison Wrote:Why don't you simply think ahead and prevent the overflows and errors from ever having occurred to begin with?I do, but i use this Method to keep my program from crashing, in case i forgot something, or if there was a missing link or file (It's very useful). I'll give you an example: this is a simple calculator code free of errors or overflows, before running.. Code: using System; & keeps me from being embarrassed in front of the Prof when i show her the Project. ^_^ RE: -C#- Error Handling - Helices - Nov 29 2011 To farther add onto MindHackers post, don't forget you can re-throw exceptions through catch: Code: catch (Exception 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! RE: -C#- Error Handling - Leaky - Nov 30 2011 Helices Wrote:To farther add onto MindHackers post, don't forget you can re-throw exceptions through catch: you would use multiple catch clauses to catch different types of exceptions. Code: try { } |