# Observer Pattern

A pattern where subscribers are notified automatically when something changes.

## What is **Observer Pattern**?

The **Observer pattern** lets objects subscribe to another object and be told when something happens. A YouTube channel notifies all its subscribers when a new video goes up.

```csharp
public class Channel
{
    public event Action<string>? VideoPublished;
    public void Publish(string title) => VideoPublished?.Invoke(title);
}

channel.VideoPublished += title => Console.WriteLine($"New video: {title}");
```

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/observer-pattern
