# try Block

*noun*

say it: **“TRY blok”** **/traɪ blɒk/**

A block of code that might throw an exception, followed by catch or finally blocks that deal with it.

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

**try Block** — A block containing code that may throw an exception.

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

## In a sentence

- “I put the file read in a **try** block so a missing file wouldn't crash the app.”

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

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

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