What\'s ArrayList in .Net (VB.Net or C#)What\'s the advantageous using ArrayList.

Showing Answers 1 - 6 of 6 Answers

sivakesh

  • Nov 28th, 2005
 

ArrayList is an extended managment of Arrays....

ArrayList can hold objects(custom...or...defined)

say i have an object user with properties name and email

my AraayList can hold users object...means  one or more

Array is Type specific....so can hold Types like int, string etc......

...Thanks, Sivakesh.

http://www.sivakesh.com

  Was this answer useful?  Yes

samiksc

  • Jan 9th, 2006
 

ArrayList class implements IList interface using an array.

Advantages:

  1. Its capacity is increased if required as objects are added to it. So it frees programmer from the worries of array overflow.
  2. Provides methods to perform common operations -- append, insert, remove, replace etc.
  3. There is no restriction on the type of objects which can be added to an arraylist. First object could be a string, second a double, third a user defined object and so on.
  4. ArrayList can be made read only after adding elements to prevent unintentional modifications.
  5. It provides an overloaded method to perform binary search on its objects.

  Was this answer useful?  Yes

Bharat Joshi

  • Jan 9th, 2006
 

ArrayList is also a datastructure in dotnet which contain data in it thr major difference in between array and arraylist is insertion and deletion of data In ArrayList we can eaisely insert Data at a particular location while in array it is not possibel

  Was this answer useful?  Yes

Sanjay Talreja

  • May 12th, 2006
 

Array is for homogeneous data. i.e data of same data type.

Whereas Arraylist is for Heterogeneous data.The data in the arraylist need not be of same data type.

Also it(arraylist) can store objects. say objects of type account.

  Was this answer useful?  Yes

Raghu

  • Jul 14th, 2006
 

Suppose that u r using an array of intgers.Which may contain any numer of integers which you know only at runtime.

So while coding u cannot specify the size of the Array.

Array list is used to solve this problem.

It has a default size(16 items).

if u have even 1 item the size will be 16.

After 16 if u add another item, the size increases to 32.

i.e the arrayList size can be increased dynamically.

  Was this answer useful?  Yes

Sonali

  • Oct 8th, 2007
 

Array is for homogeneous data. i.e data of same data type.

Whereas Arraylist is for Heterogeneous data. The data in the arraylist need not be of same data type.

Also it (arraylist) can store objects, say objects of type account.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions