Verify that a column exists in the DataRow before reading its value
<p>How do I write code that reads a DataRow but, if filed in DataRow isn't there, it just skips it and moves on, like this for example:</p>

<pre><code>string BarcodeIssueUnit;
if (dr_art_line["BarcodeIssueUnit"].ToString().Length &lt;= 0)
{
    BarcodeIssueUnit = "";
}
else
{
    BarcodeIssueUnit = dr_art_line["BarcodeIssueUnit"].ToString();
}
</code></pre>

<p>Now, the Column <code>BarcodeIssueUnit</code> can belong to the table but, in some cases, that column does not exist in the table. If it's not there and I read it, I get this error: </p>

<pre><code>System.ArgumentException: Column `BarcodeIssueUnit` 
does not belong to table Line.
</code></pre>

<p>I just want to run a check if the column is there ok, let see the values, if it's not, just skip that part and go on.</p>
