I have a DataSet
and I want to convert the DataSet
into List
T - type object
How convert my DataSet
?
This is pretty much the same as the other answers, but introduces strongly-typed columns.
var myData = ds.Tables[0].AsEnumerable().Select(r => new {
column1 = r.Field("column1"),
column2 = r.Field("column2"),
column3 = r.Field("column3")
});
var list = myData.ToList(); // For if you really need a List and not IEnumerable