I am fairly new to vb.net and came across this issue while converting a for loop in C# to VB.net I realized that the increment operators are not available in vb.net (++ and
The following extension methods replicate ++x x++ --x x--
Public Module INC_DEC
Public Function PreINC(ByRef x As Integer) As Integer
Return Interlocked.Increment(x)
End Function
Public Function PostINC(ByRef x As Integer) As Integer
Dim tmp = x
Interlocked.Increment(x)
Return tmp
End Function
Public Function PreDEC(ByRef x As Integer) As Integer
Return Interlocked.Decrement(x)
End Function
Public Function PostDEC(ByRef x As Integer) As Integer
Dim tmp = x
Interlocked.Decrement(x)
Return tmp
End Function
End Module