Common Exception Classes in .NET

Sunday, 30 October 2011

Common Exception Classes in .NET


Common Exception Classes:

The following exceptions are thrown by certain C# operations.



System.OutOfMemoryException
Thrown when an attempt to allocate memory (via new) fails.
System.OutOfMemoryExceptionThrown when the execution stack is exhausted by having too many pending method calls; typically indicative of very deep or unbounded recursion.
System.NullReferenceExceptionThrown when a null reference is used in a way that causes the referenced object to be required.
System.TypeInitializationExceptionThrown when a static constructor throws an exception, and no catch clauses exists to catch in.
System.InvalidCastExceptionThrown when an explicit conversion from a base type or interface to a derived types fails at run time.
System.ArrayTypeMismatchExceptionThrown when a store into an array fails because the actual type of the stored element is incompatible with the actual type of the array.
System.IndexOutOfRangeExceptionThrown when an attempt to index an array via an index that is less than zero or outside the bounds of the array.
System.MulticastNotSupportedExceptionThrown when an attempt to combine two non-null delegates fails, because the delegate type does not have a void return type.
System.ArithmeticExceptionA base class for exceptions that occur during arithmetic operations, such as DivideByZeroException and OverflowException.
System.DivideByZeroExceptionThrown when an attempt to divide an integral value by zero occurs.
System.OverflowExceptionThrown when an arithmetic operation in a checked context overflows.

No comments:

Post a Comment