您好如何创建像
这样的数组数组 EDIT: [[1,"aaaaaa",1],[2,"bbbbbbb",2],[3,"ccccccc",3]]
从列表中
IList<TestList>
public class TestList
{
public int x{ get; set; }
public string Name { get; set; }
public int y{ get; set; }
}
答案 0 :(得分:2)
如果我理解你在寻找什么,这应该可以解决问题:
IList<TestList> testList;
public class TestList
{
public int x{ get; set; }
public string Name { get; set; }
public int y{ get; set; }
}
var newList = testList.Select(t => new object[] { t.x, t.Name, t.y});
var myArrayOfArrays = newList.ToArray();