Difference Between Application Exception and System Exception

后端 未结 2 978
刺人心
刺人心 2021-01-04 00:41

I want to know the difference Between System.ApplicationException and System.Exception.

Can anyone explain

相关标签:
2条回答
  • 2021-01-04 01:29

    Originally they were intended to separate BCL defined and user defined Exceptions. ApplicationException was meant to be the base class for all user defined exceptions. The idea was it would give you a clean way to differintiate between framework exceptions and custom exceptions.

    Unfortunately this policy was not enforced from the start and as a result there are many contradictions to this rule in the BCL. The current recomendation is not to inherit from these exceptions.

    Here's a nice blog entry on the subject:

    • http://blogs.msdn.com/kcwalina/archive/2006/06/23/644822.aspx
    0 讨论(0)
  • 2021-01-04 01:31

    All exception derives from Exception Base class. Exceptions can be generated programmatically or can be generated by system. Application Exception serves as the base class for all application specific exception classes. It derives from Exception but does not provide any extended functionality. You should derive your custom application exceptions from Application Exception. Application exception are used when we want to define user defined exception. While system exception are all which are defined by .NET

    0 讨论(0)
提交回复
热议问题