What is the difference between Array and ArrayList?
What is the difference between array,arraylist and list, also give an example?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted May 23, 2012, 9:47 PM EDT
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 the array.
The Methods Of ArrayList class are
1)Add
2)Remove
3)Clear
4)Insert
5)TrimToSize
6)Sort
7)Reverse
Please refer the below links
http://www.c-sharpcorner.com/uploadfile/puranindia/arrays-in-C-Sharp-language/default.aspx
http://www.c-sharpcorner.com/UploadFile/puranindia/C-Sharp-arraylist/
Thanks
EhteshamRank #3,979 · 374 reputationPosted May 23, 2012, 10:10 PM EDT
SenthilkumarRank #387 · 6.5K reputationPosted May 24, 2012, 12:14 AM EDT
Simply you can say,
Array is data type oriented. It should be int or float or string or object, etc., but the arraylist is stores everything is type oriented.
The array size has to be defined and arraylist can grow dynamically. But it will take atleast 32 initially.
The Array is type safe and arraylist needs type conversion and leads runtime error.
The Arraylist belongs to system.collection and array belongs to system.Array namespace.