Convert DataTable to List

后端 未结 14 1823
挽巷
挽巷 2020-12-04 12:09

I have an strongly typed DataTable of type MyType, I\'d like convert it in a List.

How can I do this ?

Thanks.

14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 12:51

    Try this code and This is easiest way to convert datatable to list

    List listtablename = dataTablename.AsEnumerable().ToList();
    

提交回复
热议问题