ASP.Net DirectoryInfo records to be sorted and filtered
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);
精彩评论