Why nobody considered readability and maintainability?
I know the author is asking about:
var s = (string)reader[0] or var s = Convert.ToString(reader[0])
But what about:
string s = reader["Fieldname"].ToString();
it is more readable and safer if you change / delete / add columns and the index changes ... it is definitely worth it.
One guy said a hard throw is 30% faster. Okay 30% of 1 ms is 1.333 ms? Of course, not 30% of the entire data sample.
Elisabeth
source share