I have needed to do this on multiple occasions and have forgot about the ToArray method on almost every occasions. I feel ridiculous putting this out there but…

ArrayList someinfo = new ArrayList();
someinfo.Add("This");
someinfo.Add("Is");
someinfo.Add("Just");
someinfo.Add("a");
someinfo.Add("Reminder");<

string[] newarray = (string[])someinfo.ToArray(typeof(string));


Comment Section

Comments are closed.