Convert DataTable to List In C#
You can achieve in below three ways
Using a Loop.
Using LINQ.
Using a Generic Method.
Using Linq
List<Student> studentList = new List<Student>();
studentList = (from DataRow dr in dt.Rows
select new Student()
{
StudentId = Convert .ToInt32 (dr["StudentId"]),
StudentName = dr["StudentName"].ToString(),
Address = dr["Address"].ToString(),
MobileNo = dr["MobileNo"].ToString()
}).ToList();