---
title: "Why to use  \"finally\" block in c#?"  
description: "Why to use  \"finally\" block in c#?"  
author: "Pradeep kumar Patel"  
published: 2019-11-01  
canonical: https://answers.mindstick.com/qa/82456/why-to-use-finally-block-in-c-sharp  
category: "programming language"  
tags: ["c#", ".net programming"]  
reading_time: 1 minute  

---

# Why to use  "finally" block in c#?

Why to use "finally" [block](https://www.mindstick.com/interview/867/can-multiple-catch-blocks-be-executed) in c#?

## Answers

### Answer by Shikhar Arora

Finally keyword is a reserved keyword in C#.Finally block executes when the try/catch block leaves the execution, no matter what condition caused it. It always executes whether the try block executes normally or without any exception.The main purpose of finally block is to release the system resources.

```
try
{
 //code
}
catch
{
 //code
}
finally
{
 //code
}
```

\


---

Original Source: https://answers.mindstick.com/qa/82456/why-to-use-finally-block-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
