Q: 取文件夹中文件的更新时间最新10个文件记录
A:
DirectoryInfo dir
=
new
DirectoryInfo(
"
xxx
"
);
FileInfo[] files = dir.GetFiles();
List < FileInfo > topTenFiles = files.OrderByDescending(f => f.LastWriteTime).Take( 10 ).ToList();
FileInfo[] files = dir.GetFiles();
List < FileInfo > topTenFiles = files.OrderByDescending(f => f.LastWriteTime).Take( 10 ).ToList();