In this chapter you’ll:
Understand what exceptions are and how they’re handled.
Learn when to use exception handling.
Use try
blocks to delimit code that may throw exceptions.
Use throw
to indicate a problem at runtime.
Use catch
blocks to specify exception handlers.
Understand what happens to uncaught exceptions.
Understand the mechanics of the termination model of exception handling.
Use the finally
block to release resources.
See how a using
statement can auto-release resources.
Understand .NET exception class hierarchy.
Use Exception
properties.
Create new exception types.
Use C# 6’s null-conditional operator (?.
) to determine whether a reference is null before using it to call a method or access a property.
Use nullable value types to specify that a variable may contain a value or null
.
Use C# 6 exception filters to specify a condition for catching an exception.