c# List<string>和List<int>互相转换

List<string> 转 List<int>

var list = (new[]{"1","2","3"}).ToList();
var newlist = list.Select<string,int>(x =>Convert.ToInt32(x));

 

List<int> 转List<string> 

List<int> list = new List<int>(new int[] { 1,2,3 } );
List<string> newList = list.ConvertAll<string>(x => x.ToString());
posted @ 2016-09-27 11:42  随学·笔记  阅读(23120)  评论(2编辑  收藏  举报