Explore trees and tree-like structures with LINQ using tree-traversal algorithms like breadth-first and depth-first search: IEnumerable<DirectoryInfo> childDirectories = Traverse.DepthFirst(new DirectoryInfo(...), d => d.EnumerateDirectories()); IEnumerable<DirectoryInfo> parentDirectories = Traverse.Along(new DirectoryInfo(...), d => d.Parent);
$ dotnet add package TraverseNo README available.