Back

c# Operators ++ and -- are converted incorrectly to vb.net

When converting c# to VB.net the operators ++ and -- is converted incorrectly which gives incorrect results then from the original code. Consider the following c# example:- TestValue = TestArray[Index++];

This code uses the original value of say 0 in the variable "Index" and then increments the value afterwards. But converting this code to VB. net does not do this!

After conversion we get the following:-
TestValue = TestArray(System.Math.Max(System.Threading.Interlocked.Increment(Index),Index - 1))

The converted code always increments the value first and never uses the initial value of say 0 before it is incremented. You use a the function Max which take the highest value, but your use of Max never uses "Index - 1" as its always less, making it pointless to use the Max function. The proper conversion would be:
Index+=1
TestValue = TestArray(Index)

Please can you fix this bug?
» Post Comment

Comments (1)

 
No comments, yet. Be the first!

Post Comment

Your Comment :
Commenting is disabled when the portal is unlicensed.
Select...