Hi,
surprisingly I couldn't find a topic which covers this (or I'm simply blind):
I switched over from VB to C# and I've been using the
My.Computer.FileSystem.GetFiles([SomeDir],FileIO.SearchOption.SearchAllSubDirectories,new String() {"*.avi","*.mkv"})
Method.
Since the My namespace is not available from C# I was trying to use the
System.IO.Directory.GetFiles() Method.
But the filter doesn't allow me to pick more than one file extension.
And another issue which is bugging me some time now,
is that the two methods are fairly unreliable.
As soon as the method encounters an access violation it stops and returns an empty array.
Which means as soon as an user decides to mess with the access permissions
of the folder I want to read the method might fail.
Not satisfied with that I wanted to write my own method,
but the only way I know how to enumerate through the entries in a folder is the Dir() function,
which is apparently also not available in C# (or at least it shouldn't be used anymore).
Speed is also of importance since the possibility of adding a folder which has some thousand files in its folder tree exists.
Is there another function which can enumerate though folder entries,
or is there a better way to do this?
surprisingly I couldn't find a topic which covers this (or I'm simply blind):
I switched over from VB to C# and I've been using the
My.Computer.FileSystem.GetFiles([SomeDir],FileIO.SearchOption.SearchAllSubDirectories,new String() {"*.avi","*.mkv"})
Method.
Since the My namespace is not available from C# I was trying to use the
System.IO.Directory.GetFiles() Method.
But the filter doesn't allow me to pick more than one file extension.
And another issue which is bugging me some time now,
is that the two methods are fairly unreliable.
As soon as the method encounters an access violation it stops and returns an empty array.
Which means as soon as an user decides to mess with the access permissions
of the folder I want to read the method might fail.
Not satisfied with that I wanted to write my own method,
but the only way I know how to enumerate through the entries in a folder is the Dir() function,
which is apparently also not available in C# (or at least it shouldn't be used anymore).
Speed is also of importance since the possibility of adding a folder which has some thousand files in its folder tree exists.
Is there another function which can enumerate though folder entries,
or is there a better way to do this?