Get all folders from Composite
<p>I'm creating a tree structure of a given folder (only folders no files) 
also i return the security permission of each folder and add it to a list</p>

<p>Now how can i Loop through this composite and get all items and sub items</p>

<pre><code> public abstract class FolderComponent:IEnumerable
{
    public string FullName { get; set; }
    public string Name { get; set; }
    public List&lt;string[]&gt; Rules { get; set; }
    public abstract void AddFolder(FolderComponent folderComponent);
    public abstract IEnumerator GetEnumerator();
    public abstract void AssignRules();
}

public class Folder : FolderComponent
{
    public IList&lt;FolderComponent&gt; FolderComponents { get; set; }

    public Folder(string path)
    {
        FullName = path;
        FolderComponents = new List&lt;FolderComponent&gt;();
        Rules = new List&lt;string[]&gt;();
    }

    public override void AddFolder(FolderComponent folderComponent)
    {
        FolderComponents.Add(folderComponent);
    }

    public override IEnumerator GetEnumerator()
    {
        return FolderComponents.GetEnumerator();
    }

    public override void AssignRules()
    {
        // some code
        string[] rules = new string[]{"Read","Write","Execute"};
        Rules.Add(rules);
    }

}

public class Program
{
    private static FolderComponent GetFolders(string path)
    {
        FolderComponent folder = new Folder(path);
        folder.AssignRules();
        foreach (var directory in Directory.GetDirectories(path))
        {
            folder.AddFolder(GetFolders(directory));
        }
        return folder;
    }

    public static void Main()
    {

        FolderComponent folder = GetFolders(@"C\:Test");
        // How can i loop though all folder structure inside folder?


    }
}
</code></pre>
