13

What is the difference between System.Exception vs System.SystemException

Kyle Rosendo
  • 25,001
  • 7
  • 80
  • 118
Vipster
  • 131
  • 1
  • 3
  • 1
    @SeanBright I love how, two years later, I find this SO question at the top of the google search results for that very thing – cost Apr 28 '12 at 10:56

3 Answers3

11

A SystemException is usually reserved for the .NET runtime/framework to use, and not your application code. Basically, don't derive from SystemException when creating your own custom Exception class.

If you are creating your own Exception classes, you should either derive them from Exception or ApplicationException. ApplicationException was originally intended to be used for non-framework exceptions, but it has sort of fallen to the wayside. I believe the framework authors now recommend to derive your custom Exceptions from the base Exception class.

Andy White
  • 86,444
  • 48
  • 176
  • 211
5

Have a look here.

In a nutshell, System.Exception is defined by applications and System.SystemException is defined by the system (.NET Framework).

Kyle Rosendo
  • 25,001
  • 7
  • 80
  • 118
1

Here, this might help: Difference Between Application Exception and System Exception

SystemException provided as a means to differentiate between exceptions defined by the system versus exceptions defined by applications.

Community
  • 1
  • 1
ata
  • 8,853
  • 8
  • 42
  • 68