# Constructor Injection

A class asks for its dependencies in its constructor and keeps them in readonly fields. Whoever creates it passes them in, so a test can pass a fake.

![Cheat sheet: Constructor Injection](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/5fbad862f43a498b9c5d48344a418deb.webp)

- Category: C#
- Level: Journeyman
- Tags: Constructor Injection (oop), c-sharp, Dependency Injection (oop), OOP, Stub and Fake, Test Double
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/dependency-injection-constructor-injection-cheat-sheet
