Kinds of Exceptions

C# supports many standard exceptions, which are defined in exception classes. The common exception classes are listed in Table 9.1.

Table 9.1. Common Exception Classes and Their Occurrence
Name of the Exception Occurrence
System.OutOfMemoryException This exception is thrown when memory cannot be allocated through the new keyword.
System.StackOverflowException This exception is thrown when the execution stack has more method calls than it can handle.
System.NullReferenceException This exception is thrown when a reference type has not been assigned a value.
System.ArgumentNullException This exception is thrown when a null argument is passed to a method and this value cannot be accepted by the method.
System.ArgumentOutOfRangeException ...

Get Special Edition Using C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.