Mid
From PDF
OOP
C# OOP
How are interfaces used in dependency injection?
- Interfaces allow DI frameworks to inject concrete implementations at runtime.
- Promotes flexibility and testability.
public class CarService
{
private readonly IDriveable _vehicle;
public CarService(IDriveable vehicle) { _vehicle = vehicle; }
}Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png