title: Extension method return using generics
body: <p>Is it possible to return a <a href="http://msdn.microsoft.com/en-us/library/0x6a29h6(v=vs.80).aspx" rel="noreferrer">generic</a> type using <a href="http://msdn.microsoft.com/en-us/library/bb383977(v=VS.90).aspx" rel="noreferrer">extension methods</a>? </p>
  
  <p>For example, I have the following method:</p>
  
  <pre><code>// Convenience method to obtain a field within a row (as a double type) 
  public static double GetDouble(this DataRow row, string field) {
      if (row != null &amp;&amp; row.Table.Columns.Contains(field))
      {
          object value = row[field];
          if (value != null &amp;&amp; value != DBNull.Value)
              return Convert.ToDouble(value);
      }
      return 0;
  }
  </code></pre>
  
  <p>This is currently used as follows:</p>
  
  <pre><code>double value = row.GetDouble("tangible-equity");
  </code></pre>
  
  <p>but I would like to use the following code:</p>
  
  <pre><code>double value = row.Get&lt;double&gt;("tangible-equity");
  </code></pre>
  
  <p>Is this possible and if so, what would the method look like?</p>