O'Reilly logo

Applied Microsoft® .NET Framework Programming by Jeffrey Richter

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

Chapter 18. Exceptions

In this chapter, I’ll talk about a powerful mechanism that allows you to write more maintainable and robust code: exception handling. Here are just a few of the benefits offered by exception handling:

  • The ability to keep cleanup code in a localized location, and the assurance that this cleanup code will execute. By moving cleanup code out of an application’s main logic to a localized location, the application is easier to write, understand, and maintain. The assurance that the cleanup code runs means that the application is more likely to remain in a consistent state. For example, files will get closed when the code writing to the file can no longer continue what it’s doing for whatever reason.

  • The ability to keep code that ...

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