# Encapsulation

Keeping an object's data behind methods that control how it is read or changed.

## What is **Encapsulation** in C#?

**Encapsulation** — Keeping an object's data behind methods that control how it is read or changed.

```csharp
class Thermostat
{
    public int Temperature
    {
        get;
        set;
    }
}
```

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

Updated: September 27, 2026

## In other subjects

- [Encapsulation in Java](https://www.ask-codey.com/glossary/encapsulation-java)
- [Encapsulation in JavaScript](https://www.ask-codey.com/glossary/encapsulation-javascript)
- [Encapsulation in OOP](https://www.ask-codey.com/glossary/encapsulation-oop)

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