title: For loop through DataTable and set values extremely slow
body: <p>I have 2 objects, a <code>dataset.datatable</code> and a <code>sortedDictionary</code>. I have up to a couple of million records in my <code>dataset.datatable</code> and I need to check if every number that I have in my <code>sortedDictionary</code> exists in the <code>dataset.datatable</code>, if so I have to update that row's second column value (it's a boolean value).</p>
  
  <pre><code>foreach (var item in UpdatePhones)
  {
      //Run through every record
      for (var i = 0; i &lt; objDataSet.Tables[0].Rows.Count; i++)
      {
          //Check if exists
          if (Convert.ToString(objDataSet.Tables[0].Rows[i][0]) == item.Key)
          {
              //If so, update second column value
              objDataSet.Tables[0].Rows[i][1] = item.Value;
          }
      }
  }
  </code></pre>
  
  <p>My approach takes 1+ hour to update 3000 items in a 1,000,000 row <code>dataset.datatable</code>. Is there any faster approach?</p>
  
  <blockquote>
    <p>EDIT: I found a very simple solution, tho it blows my mind that it works both ways :S &lt;</p>
  </blockquote>
  
  <pre><code> foreach (var item in UpdatePhones)
   {
       DataRow[] row = objDataSet.Tables[0].Select("Number = " + item.Key);
       hrow[0][1] = item.Value;
   }
  </code></pre>