title: Conditionally average a column of data in a DataTable
body: <p>I have a DataTable object, dTable, where all the DataColumn datatypes are either string  or double. Some of the numbers in a column are not present. i.e. =null. Right now I have the below code finding the average and it works well when there are values.</p>
  
  <pre><code>var sum = dTable.AsEnumerable().Average(x =&gt; 
  {
      if (dTable.Columns[col]!=null)
      {
         return x.Field&lt;double&gt;(dTable.Columns[col].ColumnName); 
      }
      else
      {
          return ???;
      };
  
  });
  </code></pre>
  
  <p>My question is what to I return when that condition is not satisfied to skip that <em>x</em>? When I encounter an empty cell in dTable it doesn't seem to know what to do.</p>
  
  <p>Or if there is a totally different road I should be going down..please, by all means....</p>