public interface IDirectoryVisitor{ 

   public void Visit(DirectoryInfo directory); 

}

public class DirectoryMiner{

    private IList _visitors = new List();

    public void Accept(IDirectoryVisitor visitor){
        _visitors.Add(visitor);
    }

    public void MineDirectory(DirectoryInfo directory){

        _visitors.Each(v => v.Visit(directory));

        directory.GetDirectories().Each(dir=>MineDirectory(dir));
    }
}

public static EachExtension
{
   public static void Each(this IEnumerable list, Action action){

       foreach( var item in list){ action(item); }

   }
}