CHAPTER 5

image

Exception Handling

In many programming books, exception handling warrants a chapter somewhat late in the book. In this book, however, it’s near the front, for a few reasons.

The first reason is that exception handling is deeply ingrained in the .NET Runtime and is therefore very common in C# code. C++ code can be written without using exception handling, but that’s not an option in C#.

The second reason is that it allows the code examples to be better. If exception handling is presented late in the book, early code samples can’t use it, and that means the examples can’t be written using good programming practices.

What’s Wrong with ...

Get A Programmer's Guide to C# 5.0, 4th Edition 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.