I have list of emplyoees, then which one I should use between IList and List and why? I am using C#.
In which scenario I use List and IList.
Thank you.
IList represent a non-generic collection for collection of objects. If you use IList you can create customized List
s and use advantages of DIP (Dependency Inversion Principle) of OOP.
SimpleList<T> : IList<T>
{
...
}
IList<T> list1 = new List<T>();
IList<T> list2 = new SimpleList<T>();
You behave same with these two kind of lists.