Sachin Kumar
What is dependency injection in C#?
By Sachin Kumar in C# on Aug 26 2012
  • Rajendra Tripathy
    Jul, 2014 30

    Dependency Injection (DI) is a design pattern that demonstrates how to create loosely coupled classes. Typically, if Class1 and Class2 were loosely coupled, Class1 would have a reference to an interface instead of a direct binary reference to Class2. For Ex.. public class Class1 {public IClass2 Class2 { get; set; } }public interface IClass2 { }public class Class2 : IClass2 { }

    • 1
  • Akshay Patel
    Aug, 2012 30

    Dependency injection is a way of implementing inversion of control. There are four main method to implement DI. 1.Constructor methodology 2.Getter and Setter 3.Interface based DI 4.Service Locator.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS