P
Peter
I have the following code:
_transColl is a collection of classes and it contains about 42000 objects
My question is there any way I can make this code run faster?
I have found out that line 2 is realy expensive (time wise) :
'------------------------------------------------------------------
1 For n As Int32 = 1 To Me._transColl.Count - 1
2 ti = CType(Me._transColl(n), TranslateImport)
3 If ti.Key.Equals(key) Then
4 ti.TranslatedValue = val
5 End If
6 Next
'
' the following code is useless by it's very fast, proving that the line 2
is the culprint
' I've moved the line 2 out out the loop
'
ti = CType(Me._transColl(0), TranslateImport)
For n As Int32 = 1 To Me._transColl.Count - 1
If ti.Key.Equals(key) Then
ti.TranslatedValue = val
End If
Next
Thanks for any input?
_transColl is a collection of classes and it contains about 42000 objects
My question is there any way I can make this code run faster?
I have found out that line 2 is realy expensive (time wise) :
'------------------------------------------------------------------
1 For n As Int32 = 1 To Me._transColl.Count - 1
2 ti = CType(Me._transColl(n), TranslateImport)
3 If ti.Key.Equals(key) Then
4 ti.TranslatedValue = val
5 End If
6 Next
'
' the following code is useless by it's very fast, proving that the line 2
is the culprint
' I've moved the line 2 out out the loop
'
ti = CType(Me._transColl(0), TranslateImport)
For n As Int32 = 1 To Me._transColl.Count - 1
If ti.Key.Equals(key) Then
ti.TranslatedValue = val
End If
Next
Thanks for any input?