datatable list 之前相互转换
Posted zeroone
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了datatable list 之前相互转换相关的知识,希望对你有一定的参考价值。
使用
FastMember:
IEnumerable<SomeType> data = ...
DataTable table = new DataTable();
using(var reader = ObjectReader.Create(data)) {
table.Load(reader);
}
This uses the FastMember‘s meta-programming API for maximum performance. If you want to restrict it to particular members (or enforce the order), then you can do that too:
IEnumerable<SomeType> data = ...
DataTable table = new DataTable();
using(var reader = ObjectReader.Create(data, "Id", "Name", "Description")) {
table.Load(reader);
}
使用类库:
https://github.com/mgravell/fast-member
以上是关于datatable list 之前相互转换的主要内容,如果未能解决你的问题,请参考以下文章