Get rid of some recursion

May 10, 2008 ·  


I just had a doh! moment.

In .Net the System.IO.Directory object has a GetFiles method that returns all files from a directory.
I used to pair that up with some recursion to get all files from all sub directories.
BUT, heres the doh!: GetFiles has an overload that takes a SearchOptions parameter so that it can return the sub files directly.
So go back to your old unnecessary recursive code and do it the .Net way instead.

Comments

Leave a Reply