---
title: "Will finally block get executed if the exception had not occurred?"  
description: "Will finally block get executed if the exception had not occurred?"  
author: "Pushpendra Singh"  
published: 2010-10-25  
updated: 2020-09-13  
canonical: https://www.mindstick.com/interview/100/will-finally-block-get-executed-if-the-exception-had-not-occurred  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Will finally block get executed if the exception had not occurred?

Yes\

## Answers

### Answer by Shankar M

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.

### Answer by Uttam Misra

Yes\


---

Original Source: https://www.mindstick.com/interview/100/will-finally-block-get-executed-if-the-exception-had-not-occurred

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
