What is the difference between System.Exception vs System.SystemException
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
- Should I use static function in c# where many call
Have a look here.
In a nutshell,
System.Exception
is defined by applications andSystem.SystemException
is defined by the system (.NET Framework).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.
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.