Chapter 20. Exceptions and State Management

In this chapter:

Defining “Exception”

Exception-Handling Mechanics

The System.Exception Class

FCL-Defined Exception Classes

Throwing an Exception

Defining Your Own Exception Class

Trading Reliability for Productivity

Guidelines and Best Practices

Unhandled Exceptions

Debugging Exceptions

Exception-Handling Performance Considerations

Constrained Execution Regions (CERs)

Code Contracts

This chapter is all about error handling. But it’s not just about that. There are several parts to error handling. First, we’ll define what an error actually is. Then, we’ll talk about how to discover when your code is experiencing an error and about how to recover from this error. At this point, state becomes an issue because errors ...

Get CLR via C#, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.