This post will discuss how to convert a List of strings to an array of strings in C#.

The standard solution to convert a list of any type to an array of the “same” type is using the ToArray() method. The following code example creates an array of four elements by invoking the ToArray() method on a List.

Download  Run Code

 
Alternatively, to transform a list of any type to an array of “another” type, you can use the Select() method by LINQ. The following code example demonstrates how to use the Select() method to project over a list of integer values, and convert each integer to a string before invoking the ToArray() method to get an array of strings.

Download  Run Code

 
A better non-LINQ solution is to use the List<T>.ConvertAll() method for converting a list of one type to other types. We can use it as follows to convert a List of strings to an array of strings.

Download  Run Code

That’s all about converting a List of strings to an array of strings in C#.