title: What is the best way of getting value from a DataRow?
body: <p>All, I am trying to find a elegant way to retrieve value from a <code>DataRow</code>. Below is the way I had tried. please review it .And I think it is not good enough. Because it would be verbose when the number of fields which I want to retrieve is big. Any better idea? thanks.</p>
  
  <pre><code>  int result = -1;
  
    if (row["intCol"] != null)
    {
        bool bresult = int.TryParse(row["intCol"].ToString(), out result);
    }
  </code></pre>
  
  <p><strong>Updated</strong></p>
  
  <p>The <code>intCol</code> data type in DB is nullable string.</p>
  
  <p><strong>Updated</strong></p>
  
  <p>Found it from <a href="https://stackoverflow.com/questions/221582/most-efficient-way-to-check-for-dbnull-and-then-assign-to-a-variable">Most efficient way to check for DBNull and then assign to a variable?</a></p>
  
  <p>Cheers.</p>