title: This code returns distinct values. However, what I want is to return a strongly typed collection as opposed to an anonymous type
body: <p>I have the following code:</p>
  
  <pre><code>var foo = (from data in pivotedData.AsEnumerable()
                     select new
                     {
                       Group = data.Field&lt;string&gt;("Group_Number"),
                       Study = data.Field&lt;string&gt;("Study_Name")
                     }).Distinct();
  </code></pre>
  
  <p>As expected this returns distinct values. However, what I want is to return a strongly-typed collection as opposed to an anonymous type, so when I do:</p>
  
  <pre><code>var foo = (from data in pivotedData.AsEnumerable()
                     select new BarObject
                     {
                       Group = data.Field&lt;string&gt;("Group_Number"),
                       Study = data.Field&lt;string&gt;("Study_Name")
                     }).Distinct();
  </code></pre>
  
  <p>This does not return the distinct values, it returns them all. Is there a way to do this with actual objects?</p>