Convert an ArrayList of strings to a string[] array

To convert an ArrayList to an array of strings, simply do the following:

string[] stringArray = (string[])arrayList.ToArray(typeof(string));

Where arrayList is an ArrayList of strings and stringArray is an array of strings.

Advertisements