Member-only story

Difference between Array and ArrayList in C#

Shahzad Aslam
3 min readFeb 7, 2024

--

Array and ArrayList in C#

Array is related System namespace. Array is used store collections of elements for fixed size. ArrayList is related to System.Collections.Generic. ArrayList is used to store collections of elements for dynamics size.

1. Fixed Size:

Arrays have a fixed size that is determined at the time of creation. Once created, the size cannot be changed.

2. Type Safety:

Arrays are typesafe, which means they’re only intended for holding elements of a given type. The type is determined when the array is declared.

3. Performance:

Compared to ArrayLists, arrays are usually more effective in terms of performance. They have a lower overhead because they are a language-level feature.

4. Multidimensional Arrays:

Arrays can be multidimensional, meaning they can have multiple dimensions (e.g., a two-dimensional array).

5. Direct Access:

An index allows you to easily access elements in an array, enabling rapid random access.

6. Syntax:

--

--

Shahzad Aslam
Shahzad Aslam

Written by Shahzad Aslam

Welcome to c-sharptutorial.com. I am Shahzad Aslam. I am the founder of c-sharptutorial.com. I'm currently living near Islamabad, Pakistan.

No responses yet