---
title: "What is Dependency Injection in .NET Core?"  
description: "What is Dependency Injection in .NET Core?"  
author: "Anubhav Sharma"  
published: 2026-03-15  
updated: 2026-03-15  
canonical: https://www.mindstick.com/interview/34474/what-is-dependency-injection-in-dot-net-core  
category: "asp.net core"  
tags: ["asp.net core"]  
reading_time: 1 minute  

---

# What is Dependency Injection in .NET Core?

> **Dependency Injection** is a design pattern used to **achieve loose coupling between classes**.

ASP.NET Core has **built-in DI container**.

Example:

```plaintext
services.AddScoped<IUserService, UserService>();
```

Service lifetimes:

- **Transient** – new instance every time
- **Scoped** – one instance per request
- **Singleton** – one instance for application lifetime

## Answers

### Answer by Anubhav Sharma

> **Dependency Injection** is a design pattern used to **achieve loose coupling between classes**.

ASP.NET Core has **built-in DI container**.

Example:

```plaintext
services.AddScoped<IUserService, UserService>();
```

Service lifetimes:

- **Transient** – new instance every time
- **Scoped** – one instance per request
- **Singleton** – one instance for application lifetime


---

Original Source: https://www.mindstick.com/interview/34474/what-is-dependency-injection-in-dot-net-core

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
