Created
March 5, 2013 10:00
-
-
Save lcaballero/5089204 to your computer and use it in GitHub Desktop.
Recursive Linq Traversing a Tree. This version traverses a directory structure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<string> Files( | |
this string root, Func<string, bool> accept) | |
{ | |
return | |
Directory.GetFiles(root).Where(accept) | |
.Concat( | |
Directory.GetDirectories(root) | |
.SelectMany(d => d.Files(accept))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment