title: Get data type for DataRow[myColumn] and cast another variable as that type
body: <p>I have a class that needs to have a variable of an unknown numeric type.  I need to get the data type from a specific column at run time, then cast/instantiate the class variable as that type, and then keep a running total of that column as I iterate rows.  I thought about representing my class variable as <code>dynamic</code>, but that doesn't sit right with me.  I also thought about using a generic method, but again, I feel like there's a better way to do this.  A generic property would be great, but, well, you know how that story ends.</p>
  
  <p>Updated, here's what's left of the code I've been working with:</p>
  
  <pre><code>dynamic dc = dataRow["MyColumnName"];
  var tempValue = Convert.ChangeType(dataRow["MyColumnName"], Type.GetType(dc.GetType().ToString())); 
  total+= (Decimal)tempValue;
  </code></pre>