Exception Handling
Exception handling is implemented in the CLR. Each managed language exposes exception handling in a language-specific manner. In C#, there are the try, catch, throw, and finally keywords. The language compiler, such as csc, compiles code for exception handling into language-agnostic MSIL code. For the details of exception handling in C#, read Chapter 12.
There are two strategies for implementing exception handling in MSIL code: as an exception clause or as scoped exceptions.
Exception clauses are found after the core MSIL code of a method in the exception-handling section. An exception clause identifies the protected block, the exception filter, and the exception handler. Execution must fall into a protected block naturally. To ...
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