I'm with Steve. However, my tests show that strongly typed DataSets are
slightly faster than enumerations, but not enough to make me use STDs
everywhere. Enumerations (in my tests) are an order of magnitude faster
(2000 vs 200 ticks). How much you benefit from this really depends on how
often the references are made. While it might save 10% of the time to
execute a function, the function might play a .1% role in the overall
performance of the application.
--
____________________________________
Bill Vaughn
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Steve Drake said:
If you need speed and readability, you can use ENUM eg:
enum tablename
{
ID,
Name,
Other
};
and your code could read :
YourDataSetOrWhatEver.Tables[0].Rows[0][tablename.ID]
YourDataSetOrWhatEver.Tables[0].Rows[0][tablename.Name]
Cheers
Steve
I think most books on ADO.NET tells you why. It has to do with using the
field name requires the object to loop through the columns checking their
names before deciding which index it is. Using the name instead of the
ordinal value makes your code easier to read, but if you require
speed
in
a
long loop use the ordinal value.
I used the DevPartner Studio from Compuware to measure performance