[Solved] goto vs method in finally block in c#


Isn’t the goto moo and static void moo() doing the same act i.e taking me out of finally block?

No, absolutely not.

goto moo would transfer control out of the finally block completely.

moo() just calls the method, but then when the method returns you’re back in the finally block.

If you put a Console.WriteLine("Still here...") after your moo() method you’ll see that.

0

solved goto vs method in finally block in c#