Posts

Showing posts with the label #C# #Built-in Exception Classes

Built-in Exception Classes in C#

Image
C# .NET includes built-in exception classes for every possible error. The   Exception   class is the base class of all the exception classes. The following is a hierarchy of exception classes in .NET: In the above figure, the  Exception  class is the base class of the  SystemException  and  ApplicationException  classes. The  SystemException  class is the base class for all the built-in exception classes in .NET Framework. The  ApplicationException  was recommended to be base class for all your custom exceptions classes (The custom exeception class should be created if non of the system exception classes can be used and you need new exception class for business rule violations or for other application related errors). It was meant to differentiates between exceptions defined by applications versus exceptions defined by the system. However, Microsoft now recommends to derive custom exception classes from the  Exception ...