# finally Block

*noun*

say it: **“FY-nuh-lee blok”** **/ˈfaɪnəli blɒk/**

A block after try and catch that runs whether or not an exception happened.

## What is **finally Block** in C#?

**finally Block** — A block that normally runs after try and catch whether an exception occurred or not.

```csharp
class OrderReader
{
    int ReadQuantity(string text)
    {
        try
        {
            return int.Parse(text);
        }
        catch (FormatException)
        {
            return 0;
        }
    }
}
```

## In a sentence

- “The **finally** block closes the file even when reading fails.”

Level: Journeyman · [More C# terms at this level](https://www.ask-codey.com/glossary?category=c-sharp&level=3)

Updated: November 9, 2026

## In other subjects

- [finally Block in Java](https://www.ask-codey.com/glossary/finally-block)
- [finally Block in JavaScript](https://www.ask-codey.com/glossary/finally-block-javascript)
- [finally Block in PowerShell](https://www.ask-codey.com/glossary/finally-block-powershell)

Source: https://www.ask-codey.com/glossary/finally-block-c-sharp
