Ideagen interview question

What is Dependency Injection and how is it implemented in .NET Core?

Interview Answer

Anonymous

26 Jul 2025

Dependency Injection (DI) is a design pattern that allows you to inject dependencies into a class rather than hardcoding them. In .NET Core, DI is built-in via the IServiceCollection and IServiceProvider. services.AddScoped(); public class ProductController : Controller { private readonly IProductService _service; public ProductController(IProductService service) { _service = service; } }