2
Reply

Difference between Array and ArrayList

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

    a) The capacity of an Array is fixed. Where as, ArrayList can increase and decrease size dynamically.
    b) An Array is a collection of similar items. Where as, ArrayList can hold item of different types.
    c) Array is in the System namespace. Where as, ArrayList is in the System.Collections namespace.
    d) An Array can have multiple dimensions. Where as, ArrayList always has exactly one dimension.
    e) We can set the lower bound of an Array. Where as, the lower bound of an ArrayList is always zero.