Content area
Full Text
An exception is an error that occurs at runtime and terminates the normal flow of execution of a program if not handled properly. Exception handling is the technique of handling runtime errors in your application code. When exceptions occur, you may not want to reveal the actual stack trace or exception message to the user. Custom exceptions can be used to customize the exception information or add meaningful information to your exceptions when they occur while the program is in execution.
The base class for all exceptions in .Net is Exception. All exception classes in the exception hierarchy derive directly or indirectly from this class. Note that the System.ApplicationException and System.SystemException classes extend the System.Exception class which in turn is derived from the System.Object class. Note that exceptions are just like any other types.
ApplicationException vs System.Exception
To create a custom exception class, you should define a type. When designing custom exception classes, you should derive your class from System.Exception and not ApplicationException. Earlier, ApplicationException was used to create user defined exceptions. Although originally both of these classes were intended to differentiate the user defined exceptions and framework exceptions, the usage...