System.Exception vs System.SystemException

2020-08-10 07:38发布

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

标签: .net
3条回答
倾城 Initia
2楼-- · 2020-08-10 08:23

Have a look here.

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

查看更多
劳资没心,怎么记你
3楼-- · 2020-08-10 08:36

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.

查看更多
一夜七次
4楼-- · 2020-08-10 08:38

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.

查看更多
登录 后发表回答