Home > DeveloperSection > Interviews > Will finally block get executed if the exception had not occurred?

Posted on    October-25-2010 12:00 AM

 C# C# 
 2 Answer(s)
  1070  View(s)
Rate this:

Uttam Misra

Total Post:54

Posted on    October-30-2010 12:00 AM


Shankar M

Total Post:3

Posted on    February-23-2013 1:00 AM

 Any code that must be absolutely executed whether an exception is thrown or not is

 enclosed within the finally block.

For Ex: If a method opens a file, it must be closed whether an exception is raised or not.

Don't want to miss updates? Please click the below button!

Follow MindStick