Dependency Injection is a software design concept that allows you to use or inject a service in ways that are independent of any client consumption. By doing so, you essentially prevent the client from modifying dependencies when the underlying service changes.
The primary purpose of dependency injection is to separate the creation of clients’ dependencies from their behavior, thereby letting you design loosely coupled programs. In a loosely coupled program, the components usually consume functionality defined by interfaces without having any prior knowledge of which implementation classes are being used.
Dependency injection allows you to modify or tweak the behavior of an application by altering the components that implement the interfaces defining an application’s features.