How can I convert a DataTable
in IEnumerable<dynamicObject>
?
For example, I want to convert any DataTable
ID | Name DI | emaN
--------- or ---------
1 | x 2 | x
2 | y 1 | y
In a list of objects
// list 1 (ex 1) // list 2 (ex 2)
{ {
{ ID = 1, Name = "x" } { DI = 2, emaN = "x" }
{ ID = 2, Name = "y" } { DI = 1, emaN = "y" }
} }
So
list1.First().ID // 1
list2.First().emaN // "x"
How can I do it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…