G
Guest
Hi All,
I have a DataTable, something like 500x45 (45 columns). The Datatable is
a result of a query that I run against my db. I recieve updates to the
DataTable frequently, and I'd like to speed up the performance of my app. The
first thin gI did was to stop referencing columns by name, and instead
reference them by number. This helped a lot. But one thing I'd really like
to get rid of is the calls to .ToString() amd .Parse(). For example, I have
a lot of code like this:
float f = xx; // xx is some rapidly and repeatedly inputted value
DataTable.Row[x][0] = f * float.Parse( DataTable[x][10].ToString() );
I can't cast DataTable[x][10] to a float. What is the fastest way to get a
floating point representation of a particular column value in the above
example, assuming it's string represetation is a valid floating point number?
I hope the answer is not that I have to store these values somewhere else as
floats or doubles, do the arithmetic and assign the result to the DataColumn
member.
Tyson
I have a DataTable, something like 500x45 (45 columns). The Datatable is
a result of a query that I run against my db. I recieve updates to the
DataTable frequently, and I'd like to speed up the performance of my app. The
first thin gI did was to stop referencing columns by name, and instead
reference them by number. This helped a lot. But one thing I'd really like
to get rid of is the calls to .ToString() amd .Parse(). For example, I have
a lot of code like this:
float f = xx; // xx is some rapidly and repeatedly inputted value
DataTable.Row[x][0] = f * float.Parse( DataTable[x][10].ToString() );
I can't cast DataTable[x][10] to a float. What is the fastest way to get a
floating point representation of a particular column value in the above
example, assuming it's string represetation is a valid floating point number?
I hope the answer is not that I have to store these values somewhere else as
floats or doubles, do the arithmetic and assign the result to the DataColumn
member.
Tyson