C# DataTable to List – C# Programming Example
Collection

C# DataTable to List

This article describes how to convert Data Table to List of Objects. In following code, you can simply convert DataTable to object type List in C#

Firstly, we create the Extension class (as MyExtensions).

Then create a sample class for filling datatable to list ( I created Person class that Person has id, name, lastname and date )

 

After adding Person class and MyExtensions, we can write main code:

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: