1. public void StudentList()
2. {
3. // DataTable dt = new DataTable("Branches");
4. DataTable dt = new DataTable("Student");
5. dt.Columns.Add("StudentId", typeof(Int32));
6. dt.Columns.Add("StudentName", typeof(string));
7. dt.Columns.Add("Address", typeof(string));
8. dt.Columns.Add("MobileNo", typeof(string));
9. //Data
10. dt.Rows.Add(1, "Manish", "Hyderabad", "0000000000");
11. dt.Rows.Add(2, "Venkat", "Hyderabad", "111111111");
12. dt.Rows.Add(3, "Namit", "Pune", "1222222222");
13. dt.Rows.Add(4, "Abhinav", "Bhagalpur", "3333333333");
14.
15. List<Student> studentList = new List<Student>();
16. for (int i = 0; i < dt.Rows.Count; i++)
17. {
18. Student student = new Student();
19. student.StudentId = Convert .ToInt32 (dt.Rows[i]["StudentId"]);
20. student.StudentName = dt.Rows[i]["StudentName"].ToString();
21. student.Address = dt.Rows[i]["Address"].ToString();
22. student.MobileNo = dt.Rows[i]["MobileNo"].ToString();
23. studentList.Add(student);
24. }