# readonly

A field modifier allowing assignment only in the declaration or a constructor.

## What does **readonly** do in C#?

**readonly** — A field modifier allowing assignment only in the declaration or a constructor.

```csharp
class Store
{
    readonly string name;

    Store(string name)
    {
        this.name = name;
    }
}
```

Level: Apprentice · [More C# terms at this level](https://www.ask-codey.com/glossary/subjects/c-sharp/apprentice)

Updated: September 27, 2026

## In other subjects

- [readonly in HTML](https://www.ask-codey.com/glossary/readonly-html)

Source: https://www.ask-codey.com/glossary/readonly
