Nice:
if (folderPaths.Any(path => !Directory.Exists(path))) throw new DirectoryNotFoundException();
Nicer:
string pathNotFound; if (folderPaths.Any(path => !Directory.Exists(path), out pathNotFound)) throw new DirectoryNotFoundException("Could not find path: " + pathNotFound);
The implementation of
public static bool Any<T>(this IEnumerable<T> source, Func<T, bool> predicate, out T found)
left as a trivial exercise to the reader.
