var list = new List<param>();
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
var ps = typeof(param).GetProperties().ToList();//获取实体所有属性
foreach (DataRow dr in ds.Tables[0].Rows)
{
var model = new param();
ps.ForEach(p => {
if (ds.Tables[0].Columns.Contains(p.Name))
{
p.SetValue(model, Convert.ChangeType(dr[p.Name], p.PropertyType));
}
});
list.Add(model);
}
}