Hi all, I'm a newbie to C#, so please excuse me if this is a stupid question.
I need to write a program that will perform some parsing on each file in a given directory. Microsoft recommends using DirectoryInfo.GetFiles for this. Unfortunately, this particular directory can contain thousands of files; thus, the DirectoryInfo.GetFiles call takes a long time, and there's a large overhead for opening each file.
Is there a way in C# to iterate through the files one-by-one, similarly to how the Win32 FindFirstFile/FindNextFile API work ? In general, what is a good way to iterate through thousands of file in a single directory ?
I need to write a program that will perform some parsing on each file in a given directory. Microsoft recommends using DirectoryInfo.GetFiles for this. Unfortunately, this particular directory can contain thousands of files; thus, the DirectoryInfo.GetFiles call takes a long time, and there's a large overhead for opening each file.
Is there a way in C# to iterate through the files one-by-one, similarly to how the Win32 FindFirstFile/FindNextFile API work ? In general, what is a good way to iterate through thousands of file in a single directory ?