DataTableToList<T> System.Data.DataTable

.DataTableToList<T>()

Converts a DataTable into a typed List.

Method

public static List<T> DataTableToList<T>(this System.Data.DataTable table) where T : class, new()
System.Data.DataTable table

Source table to convert to a List of type T.

Example

C#
DataTable dt = new DataTable();
... // Fill dt with SQL or other data.
var myList = dt.DataTableToList<MyType>();