There are the following 2 types of exceptions:
- System Exception.
- Application Exception.
An exception raised implicitly from some predefined condition is a “System Exception”. For example DivideByZeroException, FormatException, OverFlowException and NullReference Exception
There are the following 2 types of exceptions:
- System Exception.
- Application Exception.
An exception raised implicitly from some predefined condition is a “System Exception”. For example DivideByZeroException, FormatException, OverFlowException and NullReference Exception.
If you want to learn about system exceptions then read my article:
An exception that is raised explicitly by the programmer in the application on its own condition is an “Application Exception”.
It can also referred to as a “User Defined Exception”.
Now let's we learn how to develop our own User Defined Exception.
Use the following procedure to develop a User Defined Exception.
Step 1: Inherit a class from the Exception class.
Step 2: Override the string message from the exception class.