惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
V
Visual Studio Blog
博客园_首页
Last Week in AI
Last Week in AI
J
Java Code Geeks
V
V2EX
博客园 - Franky
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
B
Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
W
WeLiveSecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
Arctic Wolf
S
Security Affairs
博客园 - 聂微东
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
雷峰网
雷峰网
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
罗磊的独立博客
I
Intezer
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
D
Docker
C
Check Point Blog
N
News | PayPal Newsroom
H
Hacker News: Front Page
T
The Blog of Author Tim Ferriss
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CXSECURITY Database RSS Feed - CXSecurity.com
SecWiki News
SecWiki News
The Last Watchdog
The Last Watchdog
Recorded Future
Recorded Future
量子位
NISL@THU
NISL@THU
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
MongoDB | Blog
MongoDB | Blog
MyScale Blog
MyScale Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
I
InfoQ
Hacker News: Ask HN
Hacker News: Ask HN

博客园 - 左少白

oracle 找回DROP掉的表 求解,工作流点通过时,弹出窗口让用户录入审核意见 oracle 游标 c# 多态 sqlserver 按五分钟分组 c# 继承 查询行转列 SqlParameter序列化的问题 oracle oracle trunc (date,dd )函数 oracle 游标 用C# 正则 提取HTML标签中的值? oracle decode 与 case when ,空的处理 oracle select for update sql1 同期进度,完成率 Oracle Index 相關知識 玩转DevExpress.XtraGrid.view.gridview oracle索引 在Oracle中进行大小写不敏感的查询2
对象集合转换为datatable
左少白 · 2010-05-25 · via 博客园 - 左少白

  private static DataTable ToDataTable(IList list)

        {

            DataTable result = new DataTable();

            if (list.Count > 0)

            {

                PropertyInfo[] propertys = list[0].GetType().GetProperties();

                foreach (PropertyInfo pi in propertys)

                {

                    if (pi.PropertyType.Name.IndexOf("Nullable") > -1)

                    {

                        result.Columns.Add(pi.Name, typeof(string));

                        continue;

                    }

                    result.Columns.Add(pi.Name, pi.PropertyType);

                }

                for (int i = 0; i < list.Count; i++)

                {

                    ArrayList tempList = new ArrayList();

                    foreach (PropertyInfo pi in propertys)

                    {

                        object obj = pi.GetValue(list[i], null);

                        tempList.Add(obj);

                    }

                    object[] array = tempList.ToArray();

                    result.LoadDataRow(array, true);

                }

            }

            return result;

        }