c# NPOI 导出23万条记录耗时12秒
先上测试代码: string connectionString = "Server=localhost;Initial Catalog=******;User ID=sa;Password=******;"; List<TestData> datas = null; using (SqlConnection db = new SqlConnection(connectionString)) { datas = db.Query<TestData>("SELECT * FROM TestData").ToList(); } System.Console.WriteLine($"数据源对象 {typeof(TestData).GetProperties().Length} 个字段,共 {datas.Count} 条记录,大小 {BinarySerializeHelper.SerializeToBytes(datas).Length/1000/1000} M"); Task.Run(() => { while (true) { System.Console.WriteLine($"{DateTime.Now} 内存 : {GC.GetTotalMemory(false) / 1000 / 1000} M"); Thread.Sleep(1000); } }); Stopwatch sw