Chapter 19. EXCEPTION HANDLING

You will learn about the following in this chapter:

  • What an exception is

  • How an uncaught exception abruptly terminates a program

  • How to use the try and catch blocks to catch and handle exceptions

  • How you can use the finally block to ensure a particular block of code is always executed

  • How multiple catch blocks allow you to catch and handle different exception types thrown from the same block of code

  • Nested try blocks

  • How to explicitly throw and rethrow an exception with the throw keyword

  • How to define your own exception types

The .NET execution engine generates an exception when a special condition arises during the runtime of a program. Special conditions are violations of the C# language rules and .NET execution environment. ...

Get C# Primer Plus 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.