C# Can a dictionary<int, myobject> be converted into a list?
<p>let's assume this is my custom object</p>

<pre><code>public class myObject
{
    public int Id {get;set;}
    public string Name {get;set;}
    public string Location {get;set;}
}
</code></pre>

<p>And I am returning a collection of <code>myObject</code> instances in a dictionary:</p>

<pre><code>return new Dictionary&lt;int, List&lt;MyObject&gt;&gt;(); 
</code></pre>

<p>This collection is basically a list of my objects.  the key refers to the parent class's <code>Id</code> which has one to many relationship with <code>myObject</code> class.</p>

<p>What is the best way to create a list out of dictionary?</p>

<p>Instead of using <code>Dictionary&lt;int, List&lt;MyObject&gt;&gt;</code>, I am planning to use:</p>

<pre><code>public class myObject
{
    public int Id {get;set;}
    public string Name {get;set;}
    public string Location {get;set;}
    public int ParentId {get;set;}**
}
</code></pre>

<p>and returning:</p>

<pre><code>return new List&lt;MyObject&gt; myObjects(); 
</code></pre>

<p>what is your suggestion?</p>
