# Singleton Pattern

A pattern that allows only one object of a class for the whole program.

## What is **Singleton Pattern**?

The **Singleton pattern** makes sure a class has only one object for the whole program, like one shared settings object. Use it sparingly: it can make testing harder.

```csharp
public sealed class AppSettings
{
    public static AppSettings Instance { get; } = new();
    private AppSettings() { }
}
```

Level: Freelancer · [More OOP terms at this level](https://www.ask-codey.com/glossary/subjects/oop/freelancer)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/singleton-pattern
