Trying to get a count of all files a folder matching a given mask, but want to avoid the expense of returning each match or even a list, since there could be potentially tens of thousands of matches.
I could do FindNextFile
repeatedly until done, but that's a lot of costly round trips.
Is there a convenience function for this?
This is the code in use now, and since all I need is the count, looking for a less-costly way to get there:
string[] files = System.IO.Directory.GetFiles(Path, InFileMask);
if (files.Length == ExpectedCount)