c# List和List互相转换

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

定义一个list< t>

List<int> list = new List<int>();
list.AddRange(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 });

类型转换(int->string)

List<string> list2 = new List<string>();
list2 = list.ConvertAll<string>(x => x.ToString());

类型转换(string->int)

List<int> list3 = new List<int>();
list3 = list.ConvertAll<int>(x => Convert.ToInt32(x));