Domanda di colloquio di Ideagen

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

Risposta di colloquio

Anonimo

26 lug 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; } }