top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the Difference between Array and ArrayList in C#.Net?

0 votes
534 views
What are the Difference between Array and ArrayList in C#.Net?
posted Apr 17, 2017 by Rohini Agarwal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

The following table lists the difference between Array and ArrayList in C#.

  1. Array is strongly typed. This means that an array can store only specific type of items\elements. ArrayList can store any type of items\elements.
  2. Array stores fixed number of elements. Size of an Array must be specified at the time of initialization. ArrayList grows automatically and you don't need to specify size.
  3. No need to cast elements of an array while retriving because it is strongly type and stores specific type of items only. Items of ArrayList need to be cast to appropriate data type while retriving.
  4. Use static helper class Array to perform different tasks on the array. ArrayList itself includes various utility methods for various tasks.
answer Apr 18, 2017 by Shivaranjini
0 votes

Array

Arrays are strongly-typed collections of the same data type and have a fixed length that cannot be changed during runtime. We can access the Array elements by numeric index. The array indexes start at zero. The default value of numeric array elements is set to zero, and the reference elements are set to null.

ArrayList

An Array list is not a strongly-typed collection. It can store the values of different data types or same datatype. The size of an array list increases or decreases dynamically so it can take any size of values from any data type. ArrayList is one of the most flexible data structures from C# Collections. ArrayList contains a simple list of values. ArrayList implements the IList interface using an array and very easily we can add, insert, delete, view etc. It is very flexible because we can add without any size information that is it will grow dynamically and also shrink.

answer Jul 5, 2019 by Rushabh Verma R.
...