我正在从大量文件中选择前一天的文件
// selecting around 80-120 files from 20,000 - 25,000
FileInfo[] files = (new DirectoryInfo(dirPath)).GetFiles("*.xml");
string[] selectedFiles = (from c in files
where c.CreationTime >= DateTime.Today.AddDays(-1) && c.CreationTime < DateTime.Today.AddHours(-2.0)
select c.FullName).ToArray();
以上运行大约需要 4-5 分钟,你能告诉我如何优化它,而不改变功能!
// file selection is between yesterday 0:00 to yesterday 22:00 <br >
如上面的代码所示。
友善的建议。