| title | try-catch-finally (C# Reference) | ||
|---|---|---|---|
| ms.date | 07/20/2015 | ||
| ms.prod | .net | ||
| ms.technology |
|
||
| ms.topic | article | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | a1b443b0-ff7a-43ab-b835-0cc9bfbd15ca | ||
| caps.latest.revision | 21 | ||
| author | BillWagner | ||
| ms.author | wiwagn |
A common usage of catch and finally together is to obtain and use resources in a try block, deal with exceptional circumstances in a catch block, and release the resources in the finally block.
For more information and examples on re-throwing exceptions, see try-catch and Throwing Exceptions. For more information about the finally block, see try-finally.
[!code-csharpcsrefKeywordsExceptions#1]
[!INCLUDECSharplangspec]
C# Reference
C# Programming Guide
C# Keywords
try, throw, and catch Statements (C++)
Exception Handling Statements
throw
How to: Explicitly Throw Exceptions
using Statement