Filtering duplicates out of an IEnumerable
<p>I have this code:</p>

<pre><code>class MyObj {
    int Id;
    string Name;
    string Location;
}

IEnumerable&lt;MyObj&gt; list;
</code></pre>

<p>I want to convert list to a dictionary like this:</p>

<pre><code>list.ToDictionary(x =&gt; x.Name);
</code></pre>

<p>but it tells me I have duplicate keys. How can I keep only the first item for each key?</p>
