In the below code in the try statement we have a return statement, will the finally block still run.
public static void Main()
// Some code
//Will this run
Yes , the finally code will run even though there is a return statement in the try. Finally block will run irrespective what happens in try block. That’s the reason why finally block is a good place to put clean up code.
This .NET interview question is taken from the book .NET interview questions and answers book by Shivprasad koirala.