C#中string和List<string>的相互装换:
List<string> list=new List<string>();
string str="";
listTostr:
str=string.Join(‘,‘,list.ToArray()); //以","存在于str中
如:list=("1","2","3");==>str="1,2,3"
strTolist:
list=str.Split(‘,‘); //以","进行断开
如:str="A,B,C";==>list=("A","B","C");
时间: 2024-10-19 13:34:13