Reputation: 1371
Hi How to create an Array of Arrays like
EDIT: [[1,"aaaaaa",1],[2,"bbbbbbb",2],[3,"ccccccc",3]]
from a list
IList<TestList>
public class TestList
{
public int x{ get; set; }
public string Name { get; set; }
public int y{ get; set; }
}
Upvotes: 0
Views: 110
Reputation: 18162
If I understand what you're looking for, this should do the trick:
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();
Upvotes: 2