Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Parallel For Loop

$
0
0
I have a parallel for loop which loops though an array of XML and replaces a tag (<Scheme Ref="Temp_Scheme"/>) whith a tag passed into the sub routine.

 
        Parallel.For(LBound(Input_Array), UBound(Input_Array), Sub(i)
                                                                   lngStart = InStr(1, Input_Array(i), "<Scheme Ref=""", CompareMethod.Binary)
                                                                   lngEnd = InStr(lngStart, Input_Array(i), "</Schemes>", CompareMethod.Binary)
                                                                   strOld = Mid(Input_Array(i), lngStart, lngEnd - lngStart)
                                                                   Input_Array(i) = Replace(Input_Array(i), strOld, Scheme_Ref, 1, 1)
                                                               End Sub)



The loops works fine for the first 49 entires in the array but for some reason doesn't make the replacement for the 50th entry (the last entry in the array), as a normal for loop the tag is changed as expected.

Am I missing anything?

Viewing all articles
Browse latest Browse all 51036

Trending Articles