Exception Handling

Definition & Meaning

Last updated 23 month ago

What is Exception Handling in .NET?

Exception handling is a mechanism wherein a Programming assemble is used to Constantly entice, intercept and deal with the mistake occurred at some stage in application execution. The Common Language Runtime (CLR) of .NET Framework is designed to use an exception coPing with Model based on exception gadgets and guarded Blocks of Code.

The features of exception coping with mechanism implemented in CLR are as follows:

a) Each language can have its Personal specification for handling exceptions without any restrictions

b) Exceptions are generated and dealt with regardless of the language used and Form of code (managed or unmanaged)

c) Exceptions may be thrown throughout manner or gadget barriers

What Does Exception Handling Mean?

.NET runtime throws exceptions as Objects derived from SySTEM.Exception elegance that contain blunders info, inclusive of message and line of code wherein the mistake occurred, and so on. The Construct "strive..Capture..Finally" is used for exception handling. While "try" (wherein exceptions are predicted) and “seize” (in which exceptions are treated) bLocks are obligatory, the "finally" (where code done anyways) block is non-obligatory.

When compared to error dealing with carried out the use of conventional strategies – like utilization of go back code as in Component Object Model (COM) and "cross to" Statements, as in Visual Basic, etc. – the main advantages of exceptions in .NET are trapping of all diSASters, elimination of process of checking return cost and its utilization (if invalid) in programs, utilization in Eventualities where there's no return fee together with Constructors, elevated reliability and higher overall performance.

While Java offers "checked" exceptions that help in stopping prevalence of unhandled exceptions throughout compilation, they can't be used for mistakes which can be unrecoverable Failure. Exception dealing with in C differs from that during .NET by not having the "finally" block for cleaning up resources and with none restrict for the form of exception.

Share Exception Handling article on social networks

Your Score to Exception Handling article

Score: 5 out of 5 (1 voters)

Be the first to comment on the Exception Handling

3541- V4

tech-term.com© 2023 All rights reserved