一,程序执行慢导致的原因就是查询数据库慢.,导致返回值慢,那这个要怎么解决呢?
1,优化数据库查询如这个文章 C#导出数据到excel如何提升性能
2,使用线程并行查询,然后合并成一个集合,代码如下,必须留意备注的核心点
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace TestConsoleApp
{
/// <summary