O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exceptions Are Objects

One question is how errors are represented in the world of exceptions. Given that the Common Language Runtime (CLR) is an object-oriented platform, the answer is pretty obvious: objects. We won’t look at how to define exception types of our own just yet but will instead focus on the essence of such a type and look at how exceptions can be thrown and caught.

Exceptions are subtypes of a class called System.Exception, which defines the following useful members (see Figure 8.1). (I’ve omitted a few irrelevant details for now.)

Image

FIGURE 8.1 Most relevant members of the Exception base type.

One key piece of information about an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required