开发者

ASP.Net DirectoryInfo records to be sorted and filtered

开发者 https://www.devze.com 2023-04-12 10:07 出处:网络
I want to meger two lines of code but I can\'t seem to figure it out. Dim filterFiles As FileInfo() = New DirectoryInfo(sPath).GetFiles().Where(Function(x) x.LastWriteTime >= (dtStartDate) AndAlso

I want to meger two lines of code but I can't seem to figure it out.

Dim filterFiles As FileInfo() = New DirectoryInfo(sPath).GetFiles().Where(Function(x) x.LastWriteTime >= (dtStartDate) AndAlso x.LastWriteTime <= 开发者_如何学Python(dtEndDate)).ToArray()

Then I want to sort them by date:

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

How can I merge the two lines to display in a grid control?


The two lines can be merged and submitted as your DataSource. This assumes .net 3.5. Sorry, but I write in C#:

gridObject.DataSource = new DirectoryInfo(sPath).GetFiles().Where(x => x.LastWriteTime >= dtStartDate && x.LastWriteTime <= (dtEndDate)).OrderByDescending(x => x.LastWriteTime);
0

精彩评论

暂无评论...
验证码 换一张
取 消