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?

1 Like

Hi!
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

HI,

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.

Regards,

Can someone please explain the use and practical application of the Invoke Method Activity when working with Lists? Please also explain what is meant by static methods and instance methods, as well as their signatures, as it pertains to the Invoke Method Activity? Thank you.

Lists are strongly typed and support generics, making them more performant and type-safe. Collections add features like read-only operations. ArrayLists are not strongly typed and don’t support generics.

List: Used for type-safe collections. IList: Interface for flexibility, allowing various list types.