SoFunction
Updated on 2025-03-06

Methods of converting between List and Array in C#

This article describes the method of converting between List and array in C#. Share it for your reference. The specific analysis is as follows:

1. List to array (Go from List<string> to string[])

List<string> listS=new List<string>(); 
("str"); 
("hello"); 
string[] str=();

2. Array to List (from string[] to List<string>)

string[] str={"str","string","abc"}; 
List<string> listS=new List<string>(str);

I hope this article will be helpful to everyone's C# programming.