DataTable和IList间转换的封装

时间:2017-04-09 12:55:03
【文件属性】:
文件名称:DataTable和IList间转换的封装
文件大小:4KB
文件格式:CS
更新时间:2017-04-09 12:55:03
DataTable IList 转换 封装 if (row != null) { obj = Activator.CreateInstance(); foreach (DataColumn column in row.Table.Columns) { PropertyInfo prop = obj.GetType().GetProperty(column.ColumnName); try { object value = row[column.ColumnName]; prop.SetValue(obj, value, null); } catch { // You can log something here throw; } } }

网友评论