de2bd2f9
“wangming”
项目初始化
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NCC.Common
{
public static class DataTableExtentions
{
/// <summary>
/// DataTable 转List 集合
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public static List<Dictionary<string, object>> DataTableToDicList(this DataTable dt)
{
return dt.AsEnumerable().Select(
row => dt.Columns.Cast<DataColumn>().ToDictionary(
column => column.ColumnName.ToLower(),
column => row[column]
)).ToList();
}
}
}
|