c# - Convert DataTable to List<T> - Stack Overflow

PHOTO EMBED

Fri May 20 2022 20:17:17 GMT+0000 (UTC)

Saved by @javicinhio #cs

List<MyType> listName = dataTableName.AsEnumerable().Select(m => new MyType()
{
   ID = m.Field<string>("ID"),
   Description = m.Field<string>("Description"),
   Balance = m.Field<double>("Balance"),
}).ToList()
content_copyCOPY

https://stackoverflow.com/questions/1427484/convert-datatable-to-listt