Click here to Skip to main content
15,888,521 members
Articles / Desktop Programming / Win32

System.IO.Directory Alternative using WinAPI

Rate me:
Please Sign up or sign in to vote.
4.80/5 (37 votes)
1 Mar 2020CPOL4 min read 42.4K   1.1K   49  
Faster and better alternative to System.IO.Directory IEnumerable methods EnumerateDirectories, EnumerateFiles and EnumerateFileSystemEntries
While working on a project that required to read contents of a Windows directory, I used the .NET provided System.IO.Directory class' methods. However, there is a big downside to using these functions. This post describes the problem. The solution given is an alternate method using Windows API, the result of which is not only better, but appears to be even faster than the .NET's original methods.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
User Interface Analyst Raiffeisenbank Austria
Croatia Croatia
I acquired Masters degree in computing science at the Faculty of Electrical Engineering and Computing in Zagreb, Croatia in 2009. Following my studies, I got a job in a Croatian branch of Austrian-based CEE Raiffeisen Bank as an MIS (Management information system) analyst.
I have been working there since 2010, as an IT expert within the Controlling department, maintaining the Oracle's OFSA system, underlying interfaces and databases.
Throughout that time, I have worked with several different technologies, which include SQL & PL/SQL (mostly), postgres, Cognos BI, Apparo, Datastage, ODI, Jenkins, Qlik, ...
I am doing a lot of automation with scripting in batch / shell and VBscript (mostly) - data analysis and processing, automated DB imports and exports, Jenkins automation etc.
Privately, I was mostly doing Windows Forms and Console app tools in Visual Studio, C#.

Comments and Discussions