public static class ConvertTableUtils
{
/// <summary>
/// 将查询表结果转化为对应的List
/// </summary>
/// <param name="table">DataTable</param>
/// <returns>List<T></returns>
public static List<T> ConverToList<T>(DataTable table) where T : new()
{
List<T> list = null;
DataColumnCollection columns = table.Columns;
int columnCount = columns.Count;
T type = new T();
Type columnType = type.GetType();
PropertyInfo[] properties = columnType.GetProperties();
list = new List<T>();
foreach (DataRow currentRow in table.Rows)
{
for (int i = 0; i < columnCount; i++) <
{
/// <summary>
/// 将查询表结果转化为对应的List
/// </summary>
/// <param name="table">DataTable</param>
/// <returns>List<T></returns>
public static List<T> ConverToList<T>(DataTable table) where T : new()
{
List<T> list = null;
DataColumnCollection columns = table.Columns;
int columnCount = columns.Count;
T type = new T();
Type columnType = type.GetType();
PropertyInfo[] properties = columnType.GetProperties();
list = new List<T>();
foreach (DataRow currentRow in table.Rows)
{
for (int i = 0; i < columnCount; i++) <