
A: DI supplies a class’s dependencies from the outside, improving testability and decoupling.
Example: In ASP.NET Core, you register IMyService in Startup.ConfigureServices and the framework injects it into controllers.
A: DI supplies a class’s dependencies from the outside, improving testability and decoupling.
Example: In ASP.NET Core, you register IMyService in Startup.ConfigureServices and the framework injects it into controllers.