I have a DataSet
and I want to convert the DataSet
into List
T - type object
How convert my DataSet
?
A very simple approach that I use is following:
List objList = new List();
foreach (DataRow _dataRow in dataSet.Tables[0].Rows)
{
Obj obj = new Obj();
obj.Col1 = Convert.ToInt32(_dataRow["Col1"]);
obj.Col2 = Convert.ToInt32(_dataRow["Col2"]);
obj.Col3 = Convert.ToString(_dataRow["Col3"]);
objList.Add(obj);
}