.net 应用异常与系统异常的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/848017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Difference Between Application Exception and System Exception
提问by Bhaskar
I want to know the difference Between System.ApplicationExceptionand System.Exception.
我想知道System.ApplicationException和System.Exception之间的区别。
Can anyone explain
谁能解释一下
回答by JaredPar
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.
最初,它们旨在将 BCL 定义的异常和用户定义的异常分开。ApplicationException 旨在成为所有用户定义异常的基类。这个想法是它会给你一种干净的方式来区分框架异常和自定义异常。
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.
不幸的是,此政策并未从一开始就强制执行,因此 BCL 中与此规则存在许多矛盾。当前的建议是不要继承这些例外。
Here's a nice blog entry on the subject:
这是一个关于这个主题的不错的博客条目:
回答by MANJUNATHA SL
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
所有异常都派生自异常基类。异常可以通过编程方式生成,也可以由系统生成。Application Exception 作为所有应用程序特定异常类的基类。它派生自 Exception 但不提供任何扩展功能。您应该从应用程序异常派生您的自定义应用程序异常。当我们想定义用户定义的异常时使用应用程序异常。而系统异常都是.NET定义的

