These Exceptions are thrown when certain errors are found in your C# code or in the methods you call.
All of these exceptions can be caught using a catch block in C#.
Here are some of the common Exceptions:
EXCEPTION CLASS | CAUSE OF EXCEPTION |
SystemException | It is used as a base class for other exceptions. Occurs on a failed run time check |
AccessException | Occurs when failed to access a type member (method or a field) |
ArgumentException | Occurs when an Argument to a method is invalid |
ArgumentNullException | Occurs when a null argument is passed to a method which does not accept it |
ArgumentOutofRangeException | Occurs when argument value is out of range |
ArithmeticException | Occurs due to arithmetic over-flow or under-flow |
ArrayTypeMismatchException | Occurs when you attempt to store different type of object in an array |
BadImageFormatException | Occurs when the image is in the wrong format |
CoreException | Its the BaseClass for the Exceptions thrown by runtime |
DivideByZeroException | Occurs when you attempt to divide by zero |
FormatException | Occurs if the format of an argument is wrong |
IndexOutofRangeException | Occurs when an array index is out of range |
InvalidCastException | Occurs when you attempt to cast to an invalid class |
InvalidOperationException | Occurs if a method is called at an invalid time |
NotFiniteNumberException | Occurs when a number is invalid |
NotSupportedException | Occurs if a method is not implemented by a class |
NullReferenceException | Occurs if you attempt to use an unassigned reference |
OutofMemoryException | Occurs if the memory is not enough for execution |
StackOverflowException | Occurs when stack overflows |