# Downcasting

Treating a parent-typed variable as a specific child type; can fail, so check first.

## What is **Downcasting**?

**Downcasting** is treating a parent-typed variable as a more specific child type. It can fail if the object isn't really that type, so check first.

```csharp
Animal pet = GetPet();
if (pet is Dog dog)
{
    dog.Fetch(); // safe: we checked it really is a Dog
}
```

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

Updated: September 27, 2026

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