C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# Exception HandlingException Handling in C# is a process to handle runtime errors. We perform exception handling so that normal flow of the application can be maintained even after runtime errors. In C#, exception is an event or object which is thrown at runtime. All exceptions the derived from System.Exception class. It is a runtime error which can be handled. If we don't handle the exception, it prints exception message and terminates the program. AdvantageIt maintains the normal flow of the application. In such case, rest of the code is executed event after exception. C# Exception ClassesAll the exception classes in C# are derived from System.Exception class. Let's see the list of C# common exception classes.
C# Exception Handling KeywordsIn C#, we use 4 keywords to perform exception handling:
Moreover, we can create user-defined exception which we will learn in next chapters.
Next TopicC# try/catch
|