Hi!
Just want to add a few things...
The idea is to program against the interface, not the implementation. So IList is interface (contract) which is used to implement List. For example if you want to write a method that return and accept "collection" of objects, you should write your method to return and accept interfaces. What interface you want to use depends on want you want to do in that method.
For example, lets say if you just want to iterate over collection then you should use the "smallest" interface type which is IEnumerable, not concrete implementation (List, Collection, ArrayList, StringCollection and so on...). Returning and accepting defined interface you only guaranties or promising that you component, method or something will behave on certain way. Look this
AddRange method that is defined on
List class:
public void AddRange (
IEnumerable<t> collection
)</t>
Using this method you can add several items into given list instance. So look its definition closely. It is defined to accept IEnumerable. this way author of this method provided you solution that you can add any collection type into given list, because every collection have IEnumebrable implemented and its the "smallest" interface type which supports a simple iteration over a collection.
If you want to read more about how and for what are interfaces used, take a look at this
book[
^]...