title: What the Exception? InvalidCastException
body: <p>In a legacy application, we have a <code>SqlDataReader</code>.  The following field creates a <code>InvalidCastException</code> with a <code>bit</code> field.</p>
  
  <pre><code>public static T GetValueOrNull&lt;T&gt;(this IDataReader reader, string column)
  {
       int ordinal;
       if(!string.IsNullOrEmpty(column) &amp;&amp; !reader.IsDBNull(reader.GetOrdinal(column)))
            if(int.TryParse(reader.GetOrdinal(column).ToString(), out ordinal))
                 return (T)reader.GetValue(ordinal);
  
        return default(T);
  }
  </code></pre>
  
  <p>What is odd, is that <code>(T)reader.GetValue(ordinal)</code> does assign a valid type.  It assigns a <code>false</code>, but the error still occurs.  I'm not entirely sure why.</p>
  
  <p>If I perform <code>GetType();</code> it does indeed show <code>Boolean</code> type.  I've also checked to ensure that it is threadsafe.</p>