Exceptions are types that are derived from the System.Exception class. We use the try block around statements that may throw an exception. When an exception occurs, control jumps to the catch statement, where CLR collects all the required stack trace information before terminating the program and displaying a message to the user. If exception handling is not done, the program just terminates with an error. While handling exceptions, it is important to understand that if we cannot handle an exception, we should not catch it. This ensures that the application will be in a known state. When you define a catch block, you define an exception variable that can be used to obtain more information, such as the origin of the exception, which line in the code threw this exception, the type of exception, and so on.
A programmer can create and throw...