In this chapter, you learned how to use exception handling to deal with errors in an app. We demonstrated that exception handling enables you to remove error-handling code from the “main line” of the program’s execution. You saw exception handling in the context of a divide-by-zero example. You learned how to use
try blocks to enclose code that may throw an exception, and how to use
catch blocks to deal with exceptions that may arise. We explained the termination model of exception handling, in which, after an exception is handled, program control does not return to the throw point. We discussed several important classes of the .NET
Exception hierarchy, including
Exception (from which user-defined exception classes are derived) ...