About This eBook by Bart De Smet

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

try Statements

Block-based exception handling is one of the core features of structured exception handling. The try statement in languages like C# reflects this. Associated with the try block are catch handlers and/or a single finally block. All forms shown here are valid based on those rules. First, a single handler:

try {    // Protected block.}catch (FirstException ex) {    // Handle the exception of the specified type.}

Second, use of multiple handlers:

try {    // Protected block.}catch (FirstException ex) {    // Handle the exception of the specified type.}catch (SecondException ex) {    // Handle the exception of the specified type.}

All these can have a finally block at the bottom, ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required