Home > Article > Backend Development > What is the base class for all exceptions in C#?
The System.SystemException class is the base class for all predefined system exceptions. Some exception classes derived from System.Exception class are System.ApplicationException and System.SystemException classes.
The System.ApplicationException class supports application-generated exceptions. Therefore, programmer-defined exceptions should be derived from this class.
The following are the exceptions under the base class System.SystemException:
Sr.No. | Exception class and description |
---|---|
1 |
System.IO.IOException Handle I/O errors. |
2 |
System.IndexOutOfRangeException Handles errors when a method reference exceeds the array index range. |
3 |
System.ArrayTypeMismatchException Handles errors where the type does not match the array type. |
4 |
System.NullReferenceException Handles errors caused by referencing null objects. |
5 |
System.DivideByZeroException Handles errors caused by dividing the dividend by zero. |
6 |
System.InvalidCastException Error thrown during handling of type conversion. |
7 |
System.OutOfMemoryException Handle errors caused by insufficient memory. |
8 |
System.StackOverflowException Handle errors caused by stack overflow. |
The above is the detailed content of What is the base class for all exceptions in C#?. For more information, please follow other related articles on the PHP Chinese website!