List<int> 转 string :
list<int>: 1,2,3,4,5,6,7 转换成字符串:“1,2,3,4,5,6,7”
List<int> list= new List<int>() { 1, 2, 3, 4, 5, 6, 7 }; string depaid = string.Join(",", list);
string 转 List<int>:
string s = "1, 2, 3"; List<string> list = new List<string>(s.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries));
List<string> list = new List<string>(s.Split(','));//或者
List<string> 转 List<int>
var listOfStrings =(new[]{"4","5","6"}).ToList();
var listOfInts = listOfStrings.Select<string,int>(q =>Convert.ToInt32(q));
List<int> 转List<string>
List<int> l1 = new List<int>(new int[] { 1,2,3 } ); List<string> l2 = l1.ConvertAll<string>(x => x.ToString());
C#中string[]数组和list<string>:
System.String[] str={"str","string","abc"}; List<System.String> listS=new List<System.String>(str);
从List<System.String>转到System.String[]
List<System.String> listS=new List<System.String>(); listS.Add("str"); listS.Add("hello"); System.String[] str=listS.ToArray();