title: Compare values of rows of datatable and list of tuples in C#
body: <p>I have a <code>datatable</code> in which one of the columns is <code>id1</code> and a list of integer tuples <code>List&lt;Tuple&lt;int,int&gt;&gt;</code>.</p>
  
  <p><code>datatable</code> column <code>id1</code> can have multiple values for a particular name. The list of tuple  is actually a reference list which contains all the ids <code>id1</code> as <code>tuple.Item1</code> and <code>id2</code> as <code>tuple.Item2</code>. I want to compare all the values of <code>id1</code> of <code>datatable</code> with the <code>id1</code> of list of tuple and only get all the corresponding <code>id2</code> from the list of tuple.</p>
  
  <p>One way is first to get all the <code>id1</code> from datatable into a list and then compare with list of tuple like</p>
  
  <pre><code>var listOfid1 = datatable.AsEnumerable()
      .Where(x =&gt; x.field&lt;int&gt;("id1"))
      .ToList();
  </code></pre>
  
  <p>And now compare this <code>listOfid1</code> with the list of tuples and get all the corresponding <code>id2</code> w.r.t <code>id1</code>.</p>
  
  <p>Can somebody help me to do this in one step, i.e. comparing all of the <code>id1</code> of the datatable with <code>id1</code> of tuple and get all the <code>id2</code> in a list?</p>