Lecture overview -- Keyboard shortcut: 'u'  Previous page: Raising and throwing exceptions in C# -- Keyboard shortcut: 'p'  Next page: Rethrowing an exception -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 24 : 30
Object-oriented Programming in C#
Exception Handling
Try-catch with a finally clause

A finally part of a try statement ensures a given code block is executed both in case of success and failure of the try-block

catch (exception-type name)

The syntax of the try-catch-finally statement C#

A try-finally control structure is sometimes used - without catch clauses - to ensure execution of the finally-block in cases the control leave the try-block abruptly

/user/normark/oop-csharp-1/sources/c-sharp/exception/finally/prog.csIllustration of try-catch-finally. This program is explained

/user/normark/oop-csharp-1/sources/c-sharp/exception/finally/outputOutput from the try-catch-finally program.