finally block
Cleanup code that runs whether the try part worked or failed.
A finally block runs when control leaves its try statement, by normal completion, return, break, or an exception.
Loading interactive…
Examples
try { Save(order); } finally { Console.WriteLine("done"); }prints "done" whetherSaveworked or threw.
See also