# using Statement

*noun*

say it: **“YOO-zing STAYT-ment”** **/ˈjuːzɪŋ ˈsteɪtmənt/**

A C# statement that closes or frees an object, such as a database connection, as soon as the code is done with it.

## What does **using Statement** do in C#?

**using Statement** — A statement that disposes a resource automatically when execution leaves its scope.

```csharp
class OrderFile
{
    string Read(string path)
    {
        using StreamReader reader = new(path);
        return reader.ReadToEnd();
    }
}
```

## In a sentence

- “The **using statement** closes the connection even if the query throws an error.”

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

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/using-statement
