How
are system exceptions different from application exceptions in .NET?
During execution
of your program, if there is any unexpected behavior then exception will
be thrown and the program will be terminated. .NET provides good exception
handling using the exception classes.
For any exception, System.Exception is the base class. This System.Exception
is classified into system exceptions and application exceptions. System
exceptions are predefined exceptions provided by .NET. All framework exceptions
form part of system exceptions. Application exceptions are application
specific, encouraging user to define their own user defined exceptions.
The exception
hierarchy of .NET is illustrated using the diagram shown below:
IMAGE
The purpose of system exception, application exception and how they are
different from one another are tabulated below:
System
Exception
Application
Exception
CLR
throws system exception
Application
throws application exception
System
exceptions are generic in nature
Application
exceptions are not generic. Each application exception has its own
customized meaning
Each
system exception has a meaning. You can directly use them or you can
derive new ones by inheriting System.Exception
Application
exceptions do not have a meaning for themselves. You have to explicitly
derive from them and create your own custom exceptions specific to
your application
Example
for system exceptions include SqlException, StackOverflowException
Example
for application exceptions include SharePointException, CmsException