K
KNE
Is there someone out there willing to compare the performance differences
between different ways of refering to column data in a DataRow / DataColumn?
I've got a DataRow with several columns of different types. Something like:
DataRow dr = myTable.Rows;
with columns like:
dr["dbInteger"]
dr["dbCurrency"]
dr["dbVarChar"]
dr["dbChar"]
etc.
To assign one of the above to a value type variable, there are usually at
least two ways I can write each assignment.
Integer:
int i = (int)dr["myInteger"];
or
int i = Convert.ToInt32(dr["dbInteger"]);
String:
string myString = (string)dr["dbVarChar"];
or
string myString = dr["dbVarChar"].ToString();
or
string myString = Convert.ToString(dr["dbVarChar"]);
Do any or all of the above require unboxing? What is the most efficient way
of accessing / referencing the value in different types of DataColumns?
Thanks,
Ken
between different ways of refering to column data in a DataRow / DataColumn?
I've got a DataRow with several columns of different types. Something like:
DataRow dr = myTable.Rows;
with columns like:
dr["dbInteger"]
dr["dbCurrency"]
dr["dbVarChar"]
dr["dbChar"]
etc.
To assign one of the above to a value type variable, there are usually at
least two ways I can write each assignment.
Integer:
int i = (int)dr["myInteger"];
or
int i = Convert.ToInt32(dr["dbInteger"]);
String:
string myString = (string)dr["dbVarChar"];
or
string myString = dr["dbVarChar"].ToString();
or
string myString = Convert.ToString(dr["dbVarChar"]);
Do any or all of the above require unboxing? What is the most efficient way
of accessing / referencing the value in different types of DataColumns?
Thanks,
Ken