Pages

Wednesday, 22 July 2015

Exception Classes

The Exception Classes

There are many different types of exceptions that can occur in a program. The BCL defines a number of exception classes, each representing a specific type. When one occurs, the CLR does the following:
  • It creates an exception object for the type.
  • looks for an appropriate catch clause to handle it.
All exception classes are ultimately derived from the System.Exception class.

An exception object contains read-only properties with information about the exception that caused it.
Property Type Description
Message string This property contains an error message explaining the cause of the exception.
StackTrace string This property contains information describing where the exception occurred.
InnerException Exception If the current exception was raised by another exception, this property contains a reference to the previous exception.
HelpLink string This property can be set by application-defined exceptions to give a URN or URL for information on the cause of the exception.
Source string If not set by an application-defined exception, this property contains the name of the assembly where the exception originated.

0 comments:

Post a Comment