Hi,
Often I have to loop through datasets, and I am wondering what is the best way to do it. I can do like this
or
Are any of these methods better than the other, faster?
Or to phrase it another way, if I know I am going to be using a class property, am I better off dumping that value in a variable, or is accessing that property just as fast as the variable.
Does this
have any advantage over
I'm concerned that count is not actually a static variable, but that each time I am accessing the property count it is calling a function get that iterates the rows collection to see how many there are.
I hope I spelled out my question clearly, I look forward to your opinions.
Often I have to loop through datasets, and I am wondering what is the best way to do it. I can do like this
Code:
dim count as integer = 0
dim numRows = mySet.Tables(0).Rows.count
while count < numRows
''code here
count += 1
end while
Code:
dim count as integer = 0
while count < mySet.Tables(0).Rows.count
''code here
count += 1
end while
Code:
dim myRow as system.data.datarow
for each myRow in linksDS.tables(0).rows
''code here
next myRow
Are any of these methods better than the other, faster?
Or to phrase it another way, if I know I am going to be using a class property, am I better off dumping that value in a variable, or is accessing that property just as fast as the variable.
Does this
Code:
dim numRows as integer = dataset.tables(0).rows.count
while count < numRows
end while
Code:
while count < dataset.tables(0).rows.count
end while
I'm concerned that count is not actually a static variable, but that each time I am accessing the property count it is calling a function get that iterates the rows collection to see how many there are.
I hope I spelled out my question clearly, I look forward to your opinions.