1

我想合并两行代码,但我似乎无法弄清楚。

Dim filterFiles As FileInfo() = New DirectoryInfo(sPath).GetFiles().Where(Function(x) x.LastWriteTime >= (dtStartDate) AndAlso x.LastWriteTime <= (dtEndDate)).ToArray()

然后我想按日期对它们进行排序:

New DirectoryInfo(sPath).GetFiles().OrderByDescending(Function(x) x.CreationTime).ToArray()

如何合并两条线以显示在网格控件中?

4

1 回答 1

1

这两行可以合并并作为您的 DataSource 提交。这假设 .net 3.5。抱歉,我用 C# 编写:

gridObject.DataSource = new DirectoryInfo(sPath).GetFiles().Where(x => x.LastWriteTime >= dtStartDate && x.LastWriteTime <= (dtEndDate)).OrderByDescending(x => x.LastWriteTime);
于 2011-10-12T20:56:11.100 回答