View Single Post
 
Old 09-01-2013, 04:08 AM
Jayme65 Jayme65 is offline
Newcomer
 
Join Date: Jan 2012
Posts: 7
Default Using Directory.GetFiles() WITH multiple extensions AND sort order

Hi,

I have to get a directory file list, filtered on multiple extensions...and sorted!

I use this, which is the fastest way I've found to get dir content filtered on multiple extensions:

Code:
Dim ext As String() = {"*.jpg", "*.bmp","*png"}
Dim files As String() = ext.SelectMany(Function(f) Directory.GetFiles(romPath, f)).ToArray
Array.Sort(files)
and then use an array sort.


I was wondering (and this is my question ) if there would be a way to do the sorting IN the same main line? A kind of:
Code:
Dim files As String() = ext.SelectMany(Function(f) Directory.GetFiles(romPath, f).Order By Name).ToArray
and, if yes, if I would gain speed doing this instead of sorting the array at the end (but I would do my test and report..as soon as I get a solution!!)?
Thanks for your help!!
Reply With Quote