13.2. C# exception hierarchy
Like Java, all exception classes are subclasses of one special exception class. [8] In Java, it is java.lang.Exception; [9] in C# the grandfather of all exception classes is System.Exception.
[8] C++ developers will find this a new idea. In C++, anything can be an exception – there is no rule to say that exceptions must be instances of any special class.
[9] Which is in turn a direct subclass of java.lang.Throwable. For Java, Throwable is a direct subclass of java.lang.Object. From Throwable, we have java.lang.Error and java.lang.Exception. C# does not differentiate between exceptions and errors.
Figure 13.4 shows some significant predefined exception classes in C#.
Figure 13.4. System.Object and some C# exception classes. ...
Get From Java to C#: A Developer's Guide 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.