0

嗨如何创建一个数组数组,如

  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; }    

    }
4

1 回答 1

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();
于 2012-12-14T18:05:40.127 回答