Table to List<object> C#
2021-01-22 15:15
标签:select containe div value you text 数据 public int 再数据库查询后的datatable我们想把它转成List 我们可以这样做 如果不确定object的类型,那我们可以这样做 标签:select containe div value you text 数据 public int 原文地址:https://www.cnblogs.com/z45281625/p/12076426.htmlpublic class MyObj
{
public string Name { get; set; }
public int ID { get; set; }
}
private ListMyObj> test(DataTable dt)
{
var convertedList = (from rw in dt.AsEnumerable()
select new MyObj()
{
ID = Convert.ToInt32(rw["ID"]),
Name = Convert.ToString(rw["Name"])
}).ToList();
return convertedList;
}
private List
文章标题:Table to List<object> C#
文章链接:http://soscw.com/essay/45486.html