First, the IList generic interface is the child of the ICollection generic interface and is the base interface of all generic lists.
It is only an interface of all generic types, and there are not many methods that can be used conveniently. If it is only used as the bearer body of the set data, it is true that IList <T> is competent.
However, in more cases, we need to process the set data and filter or sort the data. At this time, IList <T> cannot help.
1. When you only want to use the interface method, ILis <> This method is better. It does not obtain other methods and fields of the class implementing this interface, effectively saving space.
2. IList <> is an interface that defines some operation methods. You need to implement these methods by yourself.
List <> is a generic class, which has implemented the methods defined by IList <>
1 IList <Class1> IList11 = new List <Class1> ();
2 List <Class1> List11 = new List <Class1> ();
The two lines of code, from the operational point of view, are actually creating a List <Class1> object instance, that is, their operations are no different.
The type of the variable returned for saving this operation is different.
So we can understand that the two lines of code have different purposes.
1 List <Class1> List11 = new List <Class1> ();
To create a List <Class1> and use the List <T> function, perform related operations.
While
1 IList <Class1> IList11 = new List <Class1> ();
You only want to create an instance of Objects Based on the Interface IList <Class1>, but this interface is implemented by List <T>. Therefore, you only want to use the functions specified by the IList <T> interface.