Exceptions Overview
At the base of all exception classes is System.Exception, which derives from System.Object.
Note
It is possible to throw a System.Object directly from System.Object, but doing so is not consistent with how exceptions are used in the CLR. In addition, the C# compiler doesn't allow it.
Most (if not all) of the exception classes derived from System.Exception do not add functionality, but they do provide a type so that errors can be filtered and handled in the correct context as discussed previously. Many classes are derived directly from System.Exception. A couple of classes that derive directly from System.Exception are IOException and WebException. IOException is thrown when an I/O error occurs (usually the result of an operation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access