Let's say,
class Student
{
public int ID
{ get; set; }
public string Name
{ get; set; }
}
Now you've got DataTable, iterate through all records like below and store it in a
list
,
List<Student> stud = new List<Student>();
foreach(DataRow dr in dt.Rows)
{
stud.Add(new Student{ ID = int.Parse(dr["Id"].ToString()), Name = dr["Name"].ToString()});
}
return stud;
-KR