List Collection ArrayList

Can someone explain me what is the clear difference between List, collection and ArrayList?

Also please do explain me why we are using List datatype in collection and IList datatype in List while creating?

Both list and arrays are a collection type of variables.
The main difference between them is if their size is fixed or not.
Array has a fixed size, meaning that if you create an array containing 3 elements, you can’t add more than 3 or reduce it’s size.
List has a dynamic size, meaning that if you create a list containing 3 elements, you can at all time add more elements or reduce the size of the list.

Make sure to search for similar posts when browsing the forum, some might contain the information you need. :smiley:
For more info: Collection of Various Types


There are several similar types in .net

ArrayList (System.Collection.ArrayList)

ArrayList is old style list. It’s recommended to use List<T> instead of this because of performance etc.

IList and ICollection are both old style.

List<T> (System.Collection.Generic)

As this inherits IList, IList<T>, ICollection<T> etc , we can use it in many case.