Hello...
What is the diferrence b/w string array and arraylist? How to conevert string array to arraylist and vice-versa?
Thanks a ton in advance!
:)
String array & arraylist
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Zoran HorvatRank #792 · 2.9K reputationPosted Jul 29, 2011, 3:46 AM EDT
string[] array = new string[1000];
ArrayList al = new ArrayList();
al.AddRange(array);
array = new string[al.Count];
int pos = 0;
foreach (object o in al)
array[pos++] = (string)o;
List
l.AddRange(array);
array = l.ToArray();
List
Difference between array and list is this. Array is a structure consisting of successive memory locations. List is dispersed in memory and consists of many arrays (if list is long). Main consequence is that you cannot add elements to array without reallocating complete array and without copying its complete contents (in general case). In particular case you can use Array.Resize
On the contrary, you can always insert and remove items from the List
Zoran