In C#, how does a try catch finally block work?
C#
So if there is an exception, I know that it will jump to the catch block and then jump to the finally block.
Yes the finally clause gets exeucuted if there is no exception. Taking an example
try { int a = 10; int b = 20; int z = a + b; } catch (Exception e) { Console.WriteLine(e.Message); } finally { Console.WriteLine("Executed"); }
So here if suppose an exception occurs also the finally gets executed.