C# ObservableCollection<T> Distinct not as expected
<p>From what I've read on Stack and other resources, this should yield a distinct collection of objects (essentially unique), however, that's not what I'm observing as a result. Any help would be appreciated.</p>

<pre><code>ObservableCollection&lt;CompanySummary&gt; companies = 
   new ObservableCollection&lt;CompanySummary&gt;(DispatchListOriginal.Select(
   x =&gt; new CompanySummary { CompanyName = x.CompanyName, CompanyId = x.CompanyId })
   .Distinct());
</code></pre>

<p>(all of the above is on one line)</p>

<p>I've also tried this:</p>

<pre><code>ObservableCollection&lt;CompanySummary&gt; companies = new ObservableCollection&lt;CompanySummary&gt;(DispatchListOriginal.Select(x =&gt; new CompanySummary { CompanyName = x.CompanyName, CompanyId = x.CompanyId }));
CompanyList = new ObservableCollection&lt;CompanySummary&gt;(companies.Distinct());
</code></pre>

<p>The result in both cases is a collection of <code>CompanySummary</code> objects however, there are duplicates.</p>