title: Select DISTINCT on a column when selecting multiple columns in Linq
body: <p>I'm selecting multiple columns from a table (id, name). I would like to get back records with distinct name.  I'm wondering how to do this in LINQ. </p>
  
  <p>The following code returns a <code>Dictionary&lt;string,string&gt;</code>  </p>
  
  <pre><code>return db.CourseTypes
      .Select(ct =&gt; new { ct.Id, ct.Name})
      .AsEnumerable()
      .ToDictionary(kvp =&gt; kvp.Id.ToString(), kvp =&gt; kvp.Name);
  }
  </code></pre>
  
  <p>How can I make sure to get back records with distinct values in the 'Name' column?</p>