Need to get all the files contained in a directory, recursively searching through sub directories? No problem!
Here is how to do it without writing your own recursive function:
var fileNames = Directory.GetFiles(directoryName, "*.*", SearchOption.AllDirectories);
That’s it! No explicit recusrion required!
If you want to do searching where you can stop when a given file is found, then you would need to implement the recursion yourself. This article shows you how to do that if needed: