How to get list of files / folders as IEnumerable and not an array

how to get list of files / folders as IEnumerable and not array?

the reason I want to do this is to have many folders with 20,000+ files in them, and I need to skip all of them, but don't want to wait for them to compile into an array. but just want to go through one at a time.

Also I am using .net 3.5 not v4

+2


a source to share


2 answers


I'm sure Mono has an API to do this and you can include mono dll in your .Net 3.5 application. I'll try to dig up the exacy library and syntax.



Another option is to use Reflector and try to bring back the new .Net 4 functionality.

+1


a source


Too bad you're not on .net 4 - it looks like they added this functionality .

Also, I can't provide any code as I have no experience with this, but perhaps P / Invoke wraps some C code using FindFirstFile / FindNextFile ?



EDIT: A little googling has turned up some code in the Code Project .

+6


a source







All Articles