10.6. Summary
The .NET CLR supports exception handling in the form of a Java-style try-catch-finally construct. Here are the key points to keep in mind about C# exception handling:
A try block must be followed by one or more catch blocks or by a finally block, or both.
The most general exception needs to be caught in the last catch block.
A try-catch block can be nested. Exceptions bubble up the execution stack to outer try-catch blocks. Any uncaught exceptions bubble up the method call stack until they are handled by the CLR.
Like Java, C# has one System.Exception class from which all other exception classes inherit.
C# does not support checked exceptions, unchecked exceptions, or errors.
C# allows implementing classes to throw exceptions that are ...
Get .NET for Java Developers: Migrating to 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.