Hi experts, I'm Currently working on a project converting VB codes to C#. Now I'm facing a problem and not understand the VB Code to convert below codes into C# synthax.
Please help to explain the below codes and provide me some hint on how to convert it.
Please help to explain the below codes and provide me some hint on how to convert it.
Code:
Private Function Power2(ByVal exponent As Long) As Long
Static result(0 To 31) As Long, i As Integer
' Evaluate all powers of 2 only once.
If result(0) = 0 Then
result(0) = 1
For i = 1 To 30
result(i) = result(i - 1) * 2
Next
result(31) = &H80000000 ' This is a special value.
End If
Power2 = result(exponent)
End Function
Comment