I have a DataTable with 4 Columns (Name, Contact, Address, Marks). I want to convert my DataTable to a List<KeyValuePair<String, int>>. I would like to add Name and Marks in that. I was looking at this question but there is no exact answer to what I’m after.
Can someone please tell me how I could convert the data table without using Linq. The List could have duplicate records so I am thinking to use Tuple. If it is possible with that then please help me with some examples.
This should do it. dt is of course the name of your datatable. You might also want to do dr[“ColName”] instead of dr[0] 🙂