This exception handles errors that are generated due to insufficient free memory. Consider the above program to demonstrate System.OutOfMemoryException.
try { //user code which can throw OutOfMemoryException } catch(OutOfMemoryException exception) { //statements to handle the exception }
This exception handles errors that are generated from referencing a null object. Consider the above program to demonstrate System.NullReferenceException.
try { //user code which can throw NullReferenceException } catch(NullReferenceException exception) { //statements to handle the exception }
This exception handles errors that are generated during typecasting. Consider the above program to demonstrate System.InvalidCastException.
try { //user code which can throw InvalidCastException } catch(InvalidCastException exception) { //statements to handle the exception }
This exception handles errors that are generated when there is a mismatch of type with the array type. Consider the above syntax to demonstrate System.ArrayTypeMismatchException.
try { //user code which can throw ArrayTypeMismatchException } catch(ArrayTypeMismatchException exception) { //statements to handle the exception }
This exception handles errors that are generated when a method is referring to an array that is out of range. Consider the above syntax to demonstrate System.IndexOutOfRangeException.
try { //user code which can throw IndexOutOfRangeException } catch(IndexOutOfRangeException exception) { //statements to handle the exception }
This exception handles errors that are generated when a dividend is divided by zero. Consider the above syntax to demonstrate System.DivideByZeroException.
try { //user code which can throw DivideByZeroException } catch(DivideByZeroException exception) { //statements to handle the exception }
This exception handles errors that are generated from stack overflowing. Consider the above syntax to demonstrate System.StackOverflowException.
try { //user code which can throw StackOverflowException } catch(StackOverflowException exception) { //statements to handle the exception }
This exception handles the errors generated by the input and output. Consider the above syntax to demonstrate System.IO.IOException.
try { //user code which can throw System.IO.IOException } catch(System.IO.IOException exception) { //statements to handle the exception }