using System;
public class Program
{
// see: https://stackoverflow.com/a/61674051/1016343
public static void Main()
Console.WriteLine("Hello World");
MyFunction();
}
public static void MyFunction()
void FinalActions()
for (int i = 0; i < 100; i++)
if (i>10)
Console.WriteLine("more than 10 ... ending.");
// this returns from the local function and hence ends the finally block
return;
try {
// whatever you want to do here
catch (Exception ex) {
Console.WriteLine(ex.ToString());
finally {
FinalActions();