Convert DataTable to List

后端 未结 14 1832
挽巷
挽巷 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:58

    Create a list with type by extend the datatable with AsEnumerable call.

    var mylist = dt.AsEnumerable().ToList();
    

    Cheers!! Happy Coding

提交回复
热议问题