title: How can I select distinct column combinations from a DataTable object with another column as a condition?
body: <p>I'm using C# 2010.</p>
  
  <p>I have a DataTable object I'm working with which has the following structure (and is filled with sample data):</p>
  
  <pre><code>"name"    "ID"    "hiredate"    "termdate"
  Bobby     1        5/1/2011       7/1/2011
  Peggy     2        5/1/2011
  Jenny     3        5/2/2011
  Jenny     3        5/2/2013
  Jenny     3        5/2/2011       6/1/2011
  Peggy     2        5/1/2011
  </code></pre>
  
  <p>I want to filter this DataTable to keep only distinct ("ID","hiredate") combinations. Furthermore, as you can see, not everyone has a "termdate" value. When deciding which distinct ("ID","hiredate") combination to keep, I want to keep the one that also has a "termdate". If there's no "termdate" in any of them it doesn't matter which one is discarded.</p>
  
  <p>So the resulting table after doing this would be:</p>
  
  <pre><code>"name"    "ID"    "hiredate"    "termdate"
  Bobby     1        5/1/2011       7/1/2011
  Peggy     2        5/1/2011
  Jenny     3        5/2/2013
  Jenny     3        5/2/2011       6/1/2011
  </code></pre>
  
  <p>Jenny has two entries because she appeared with two different "hiredate" values, and one of them was also duplicated - the entry without the "termdate" was removed.</p>
  
  <p>Any suggestions for how to do this in C#? Again, I'm using a DataTable object. I still need to keep the "name" and "termdate" fields - if I didn't, then I was able to get a distinct ("ID","hiredate") list, but they really need to be retained.</p>
  
  <p>Thanks for your help!</p>