C# List<string>和List<int>互相转换
作者:互联网
1 List<string> 转 List<int>
1 var strList = new List<string>{"1","2","3"}; 2 var intList = strList.Select<string,int>(x =>Convert.ToInt32(x));
2 List<int> 转 List<string>
1 List<int> intList = new List<int> { 1,2,3 }; 2 List<string> strList = intList.ConvertAll<string>(x => x.ToString());
3 List<string> 转 List<long>
1 1 var strList = new List<string>{"1","2","3"}; 2 2 var longList = strList.Select<string,long>(x =>Convert.ToInt64(x));
标签:Convert,转换,C#,List,var,intList,new,strList 来源: https://www.cnblogs.com/ElvisZhongShao/p/10595173.html