这里是转换代码List to List:
List<string[]> obj = new List<string[]>();
obj.Add(new string[]{"1", "2", "3", "4"});
obj.Add(new string[] { "1", "2", "3", "4" });
obj.Add(new string[] { "1", "2", "3", "4" });
obj.Add(new string[] { "1", "2", "3", "4" });
var l1 = obj.ConvertAll(s=>Int32.Parse(s.ToString()));
以及如何从类对象(FreightInTeritory)转换为例如List [string []]非常感谢.....
public class FreightInTeritory
{
private string territoryDescription;
private double freight;
public string TerritoryDescription { get; set; }
public string Freight {get; set;}
}
答案 0 :(得分:1)
你为什么要转换?你可以从一开始就列出一个int。
List<int[]> obj = new List<int[]>();
并添加值
obj.Add(new int[]{1, 2, 3});
FreightInTeritory对象可以存储在FreightInTeritory列表中
List<FreightInTeritory> FreightInTeritoryList = new List<FreightInTeritory>();