dataTable转换特定的类

var query = dt
.AsEnumerable()
.Where(x => x.Field<string>("phoneNumber") != string.Empty)
.Select(x => new Contact
{
FirstName = x.Field<string>("First Name"),
LastName = x.Field<string>("Last Name"),
PhoneNumber = x.Field<string>("Phone Number"),
});

posted @ 2020-04-26 16:54  dandan00056  阅读(148)  评论(0编辑  收藏  举报