What is an Exception in .NET?- Exceptions are errors that occur during the runtime of a program. - The advantage of using exceptions is that the program doesn’t terminate due to the occurrence of the exception. - Whenever an exception is occurred the .NET runtime throws an object of specified type of Exception. - The class ‘Exception’ is the base class of all the exceptions.
Here are a few common types of exceptions:
- ArgumentException - ArgumentNullException - ArgumentOutOfRangeException - DuplicateWaitObjectException - ArithmeticException - DivideByZeroException - OverflowException - NotFiniteNumberException - ArrayTypeMismatchException - ExecutionEngineException - FormatException - IndexOutOfRangeException - InvalidCastException - InvalidOperationException - ObjectDisposedException - InvalidProgramException - IOIOException - IODirectoryNotFoundException - IOEndOfStreamException - IOFileLoadException - IOFileNotFoundException - IOPathTooLongException - NotImplementedException - NotSupportedException - NullReferenceException - OutOfMemoryException - RankException - SecuritySecurityException - SecurityVerificationException - StackOverflowException - ThreadingSynchronizationLockException - ThreadingThreadAbortException - ThreadingThreadStateException - TypeInitializationException - UnauthorizedAccessException
It is a runtime error which occurs because of unexpected and invalid code execution. .Net had enhanced exception handling features. All exceptions inherit from System.Exception.
|