So a method like this:
private string GetHUDLineDescription(int theHUDLine) {
foreach (DataRow dr in myDtHudLines.Rows) {
if (((int) dr["HUDLineID"]) == theHUDLine) {
return (string) dr["HUDLineDefaultDescription"];
}
}
return "No HUD Line Description found";
}
would be a lot faster as a select?
William Ryan said:
I've found that the Select statement tends to be quicker, but in most
instances, the difference is negligible. However, there's one case where
it's rather profound...if you reference your column names by name
instead
of
index. On bigger tables, particularly ones with many columns, if you use
Named based referencing, it's abysmal.
ALso, selecting on a column is based on a key which is a unique value...so
you can go directly to it instead of iterating through unnecessary values.
I believe it's the same concept as a hash table, which finds key values much
faster than iterating over and over a similar structure.
HTH,
Bill
matches
the