How to convert IList <string> to string [] without using Linq
5 answers
Use ICollection<T>.CopyTo :
string[] strings = new string[list.Count]; list.CopyTo(strings, 0); I'm not quite sure if I understand the no-LINQ constraint? It looks like you would use ToArray if it had an IList<T> . But it turns out that IEnumerable<T>.ToArray is an extension method defined on IEnumerable<T> that is implemented by IList<T> . So why don't you just use this?
+26