C# IEnumerable<T>转换成DataTable publicstaticDataTableToDataTableT(thisIEnumerableTlist){DataTabledataTablenewDataTable();PropertyInfo[]arraynull;foreach(Titeminlist){if(arraynull){arrayitem.GetType().GetProperties();PropertyInfo[]array2array;foreach(PropertyInfopropertyInfoinarray2){TypetypepropertyInfo.PropertyType;if(type.IsGenericTypetype.GetGenericTypeDefinition()typeof(Nullable)){typetype.GetGenericArguments()[0];}dataTable.Columns.Add(newDataColumn(propertyInfo.Name,type));}}DataRowdataRowdataTable.NewRow();PropertyInfo[]array3array;foreach(PropertyInfopropertyInfo2inarray3){dataRow[propertyInfo2.Name]((propertyInfo2.GetValue(item,null)null)?DBNull.Value:propertyInfo2.GetValue(item,null));}dataTable.Rows.Add(dataRow);}returndataTable;}

相关新闻

最新新闻

SerenityOS:一个连内核都自己造的图形化操作系统

SerenityOS:一个连内核都自己造的图形化操作系统

SerenityOS:一个连内核都自己造的图形化操作系统 【免费下载链接】serenity The Serenity Operating System 🐞 项目地址: https://gitcode.com/GitHub_Trending/se/serenity SerenityOS 是一套面向 64 位 x86、Arm、RISC-V 的图形化 Unix 风格开…

2026/9/2 13:08:32
go-zero 数据库性能优化:TakeCtx 缓存与读写分离的落地路径

go-zero 数据库性能优化:TakeCtx 缓存与读写分离的落地路径

go-zero 数据库性能优化:TakeCtx 缓存与读写分离的落地路径 【免费下载链接】go-zero A cloud-native Go microservices framework with cli tool for productivity. 项目地址: https://gitcode.com/GitHub_Trending/go/go-zero 凌晨两点,用户详情…

2026/9/2 13:08:32
Ryujinx 实战:30 分钟在 PC 上跑起第一个 Switch 游戏

Ryujinx 实战:30 分钟在 PC 上跑起第一个 Switch 游戏

Ryujinx 实战:30 分钟在 PC 上跑起第一个 Switch 游戏 【免费下载链接】Ryujinx 用 C# 编写的实验性 Nintendo Switch 模拟器 项目地址: https://gitcode.com/GitHub_Trending/ry/Ryujinx Ryujinx 是用 C# 编写的开源 Nintendo Switch 模拟器,让你…

2026/9/2 13:08:32
agentmemory背后的iii-engine:三个原语组成的新运行时

agentmemory背后的iii-engine:三个原语组成的新运行时

agentmemory背后的iii-engine:三个原语组成的新运行时 【免费下载链接】agentmemory #1 Persistent memory for AI coding agents based on real-world benchmarks 项目地址: https://gitcode.com/GitHub_Trending/age/agentmemory agentmemory 是一个为 AI …

2026/9/2 13:08:32
TabbyML 集成 DeepSeek API:三步搭建私有化 AI 代码补全

TabbyML 集成 DeepSeek API:三步搭建私有化 AI 代码补全

TabbyML 集成 DeepSeek API:三步搭建私有化 AI 代码补全 【免费下载链接】tabby Self-hosted AI coding assistant 项目地址: https://gitcode.com/GitHub_Trending/tab/tabby TabbyML 是一个自托管 AI 编码助手,通过 tabby-agent 语言服务器向编…

2026/9/2 13:08:32
raygui 即时模式 GUI:3 步搭出可交互参数面板,不用第三方库

raygui 即时模式 GUI:3 步搭出可交互参数面板,不用第三方库

raygui 即时模式 GUI:3 步搭出可交互参数面板,不用第三方库 【免费下载链接】raylib A simple and easy-to-use library to enjoy videogames programming 项目地址: https://gitcode.com/GitHub_Trending/ra/raylib raygui 是 raylib 自带的单头…

2026/9/2 13:03:32