Monday, July 7, 2014

Difference between Array and ArrayList

Hello Friends,
This time also I am writing on  difference between ..
Today we will try to see some difference between Array and ArrayList

Array is the collection of values of the same data type
>the variables in an array is called array elements
>Array is a reference type data type
>The array
 structure in System's Memory


Array list is a class .
>when you want to access the elements of an array through its
index value location in an array,use an ArrayList.
>The use of the arraylist is an alternative to the use of th array.
>The Methods Of ArrayList class are
1)Add
2)Remove
3)Clear
4)Insert
5)TrimToSize
6)Sort
7)Reverse

Array mainly used to save variables of same data type.But array list is used to store and retrieve the variables of different data type.

You cant resize an array but you can do it with array list.

Array:-
Provides methods for creating,
 manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.

array list-
Implements the
 System.Collections.IList interface using an array whose size is dynamically increased as required.

IList InterFace
Represents a non-generic
 collection of objects that can be individually accessed by index.


Array is used for fixed size
while array list is dynamically increasing at run time that is size of array list increasing as per requirement.


Array is value Type And of fixed size, and can handle only one Type.

Array list is Reff Type. And Can be appended or restricted at any moment.


Hope it will help you somewhere.

Till the time 

Enjoy the day with Lots of smile and Happiness.....

No comments:

Post a Comment