Convert Object Hierarchy to Object Array
<p>All, I want to create an object array <code>foo[]</code>, where the constructor for <code>Foo</code> is </p>

<pre><code>public Foo(string name, string discription){}
</code></pre>

<p>I have a database object which has a structure (not incuding stored procedures, functions or views for simplicity) like </p>

<pre><code>public class Database 
{
    public string name { get; set; }
    public string filename { get; set; }
    public List&lt;Table&gt; tables { get; set; }

    public Database(string name, string filename)
    {
        this.name = name;
        this.filename = filename;
    }
}

protected internal class Table 
{
    public string name { get; set; }
    public List&lt;Column&gt; columns { get; set;}

    public Table(string name, List&lt;Column&gt; columns)
    {
        this.name = name;
        this.columns = columns;
    }
}

protected internal class Column
{
    public string name { get; set; }
    public string type { get; set; }

    public Column(string name, string type, int maxLength, 
                  bool isNullable)  
    {
        this.name = name;
        this.type = type;
    }
}
</code></pre>

<p><em>I would like to know the quickest way to add <code>Column</code> and <code>Table</code> information to the <code>Foo[]</code> object array?</em> </p>

<p>Clearly I can do </p>

<pre><code>List&lt;Foo&gt; fooList = new List&lt;Foo&gt;();
foreach (Table t in database.tables)
{
    fooList.Add(new Foo(t.Name, "Some Description"));
    foreach (Column c in t.columns)
        fooList.Add(new Foo(c.Name, "Some Description"));
}
Foo[] fooArr = fooList.ToArray&lt;Foo&gt;();
</code></pre>

<p><em>But is there a quicker way?</em> Clearly LINQ is likely to be slower for a query that does a simalar operation, but I care allot about speed here so any advice would be appreciated. Perhaps the use of a HashSet would be the way to go as there will not be duplicate entries...</p>

<p>Thanks for your time.</p>
