Pages

Monday, January 9, 2012

ArrayList to String

Create the sample data:
ArrayList arrLst = new ArrayList();

string strCommaDelimited = "";

for(int x=0; x<5; x++)
{
arrLst.Add(x);
}


Convert ArrayList to String Array:
string[] tmpStringArray = (string[])arrLst.ToArray(typeof(string));


Convert String Array created to String:
strCommaDelimited = String.Join(",", tmpStringArray);